package com.ufgov.zc.client.zc.project.integration_dt;import java.awt.BorderLayout;import java.awt.Color;import java.awt.DefaultKeyboardFocusManager;import java.awt.Dimension;import java.awt.FlowLayout;import java.awt.Font;import java.awt.Dialog.ModalityType;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.FocusEvent;import java.awt.event.FocusListener;import java.math.BigDecimal;import java.util.ArrayList;import java.util.Calendar;import java.util.Date;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JComponent;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JSplitPane;import javax.swing.JTabbedPane;import javax.swing.JTable;import javax.swing.border.TitledBorder;import javax.swing.event.ListSelectionEvent;import javax.swing.event.ListSelectionListener;import javax.swing.event.TableModelEvent;import javax.swing.event.TableModelListener;import javax.swing.table.TableModel;import org.apache.commons.lang.ObjectUtils;import org.apache.log4j.Logger;import com.ufgov.smartclient.component.table.fixedtable.JPageableFixedTable;import com.ufgov.zc.client.common.AsOptionMeta;import com.ufgov.zc.client.common.BillElementMeta;import com.ufgov.zc.client.common.LangTransMeta;import com.ufgov.zc.client.common.ListCursor;import com.ufgov.zc.client.common.MyTableModel;import com.ufgov.zc.client.common.ServiceFactory;import com.ufgov.zc.client.common.WorkEnv;import com.ufgov.zc.client.common.converter.zc.ZcEbProjectToTableModelConverter;import com.ufgov.zc.client.component.GkCommentDialog;import com.ufgov.zc.client.component.GkCommentUntreadDialog;import com.ufgov.zc.client.component.JFuncToolBar;import com.ufgov.zc.client.component.JSaveableSplitPane;import com.ufgov.zc.client.component.JTablePanel;import com.ufgov.zc.client.component.WorkflowTrace;import com.ufgov.zc.client.component.button.AddButton;import com.ufgov.zc.client.component.button.AgreeButton;import com.ufgov.zc.client.component.button.AuditFinalPassButton;import com.ufgov.zc.client.component.button.CallbackButton;import com.ufgov.zc.client.component.button.DeleteButton;import com.ufgov.zc.client.component.button.DisagreeButton;import com.ufgov.zc.client.component.button.EditButton;import com.ufgov.zc.client.component.button.ExitButton;import com.ufgov.zc.client.component.button.FuncButton;import com.ufgov.zc.client.component.button.IsSendToNextButton;import com.ufgov.zc.client.component.button.NextButton;import com.ufgov.zc.client.component.button.PreviousButton;import com.ufgov.zc.client.component.button.SaveButton;import com.ufgov.zc.client.component.button.SendButton;import com.ufgov.zc.client.component.button.SendToProcurementUnitButton;import com.ufgov.zc.client.component.button.SendToXieBanButton;import com.ufgov.zc.client.component.button.SubaddButton;import com.ufgov.zc.client.component.button.SubdelButton;import com.ufgov.zc.client.component.button.SubinsertButton;import com.ufgov.zc.client.component.button.SuggestAuditPassButton;import com.ufgov.zc.client.component.button.TraceButton;import com.ufgov.zc.client.component.button.UnauditButton;import com.ufgov.zc.client.component.button.UntreadButton;import com.ufgov.zc.client.component.event.ValueChangeEvent;import com.ufgov.zc.client.component.event.ValueChangeListener;import com.ufgov.zc.client.component.table.BeanTableModel;import com.ufgov.zc.client.component.table.celleditor.DateCellEditor;import com.ufgov.zc.client.component.table.celleditor.IntCellEditor;import com.ufgov.zc.client.component.table.celleditor.MoneyCellEditor;import com.ufgov.zc.client.component.table.celleditor.TextCellEditor;import com.ufgov.zc.client.component.table.celleditor.zc.ZcBCatalogueCellEditor;import com.ufgov.zc.client.component.table.cellrenderer.DateCellRenderer;import com.ufgov.zc.client.component.table.cellrenderer.LineWrapCellRenderer;import com.ufgov.zc.client.component.table.cellrenderer.NumberCellRenderer;import com.ufgov.zc.client.component.table.codecelleditor.AsValComboBoxCellEditor;import com.ufgov.zc.client.component.table.codecelleditor.CompanyCellEditor;import com.ufgov.zc.client.component.table.codecelleditor.FileCellEditor;import com.ufgov.zc.client.component.table.codecellrenderer.AsValCellRenderer;import com.ufgov.zc.client.component.table.codecellrenderer.CompanyCellRenderer;import com.ufgov.zc.client.component.ui.conditionitem.ConditionFieldConstants;import com.ufgov.zc.client.component.ui.fieldeditor.AbstractFieldEditor;import com.ufgov.zc.client.component.zc.AbstractMainSubEditPanel;import com.ufgov.zc.client.component.zc.fieldeditor.AsValFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.AutoNumFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.DateFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.ForeignEntityFieldCellEditor;import com.ufgov.zc.client.component.zc.fieldeditor.MoneyFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.OrgFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.TextFieldEditor;import com.ufgov.zc.client.datacache.AsValDataCache;import com.ufgov.zc.client.datacache.CompanyDataCache;import com.ufgov.zc.client.util.SwingUtil;import com.ufgov.zc.client.zc.ZcUtil;import com.ufgov.zc.client.zc.bulletin.AbstractZcEbBulletinEditProjPanel;import com.ufgov.zc.client.zc.bulletin.ZcEbBulletinXunJiaBidEditProjPanel;import com.ufgov.zc.client.zc.project.integration.zbbook.services.ZbBookOperatorsService;import com.ufgov.zc.client.zc.ztb.ChangeChineseNumber;import com.ufgov.zc.common.commonbiz.model.WfAware;import com.ufgov.zc.common.console.model.AsEmp;import com.ufgov.zc.common.system.Guid;import com.ufgov.zc.common.system.RequestMeta;import com.ufgov.zc.common.system.constants.ZcSettingConstants;import com.ufgov.zc.common.system.dto.ElementConditionDto;import com.ufgov.zc.common.system.util.DateUtil;import com.ufgov.zc.common.system.util.DigestUtil;import com.ufgov.zc.common.system.util.ObjectUtil;import com.ufgov.zc.common.zc.foreignentity.IForeignEntityHandler;import com.ufgov.zc.common.zc.model.ZcBaseBill;import com.ufgov.zc.common.zc.model.ZcEbBidCondition;import com.ufgov.zc.common.zc.model.ZcEbBulletin;import com.ufgov.zc.common.zc.model.ZcEbEntrust;import com.ufgov.zc.common.zc.model.ZcEbPack;import com.ufgov.zc.common.zc.model.ZcEbPackReq;import com.ufgov.zc.common.zc.model.ZcEbPlan;import com.ufgov.zc.common.zc.model.ZcEbProj;import com.ufgov.zc.common.zc.model.ZcEbProjZbFile;import com.ufgov.zc.common.zc.model.ZcEbRequirementDetail;import com.ufgov.zc.common.zc.model.ZcEbXunJia;import com.ufgov.zc.common.zc.publish.IZcEbBaseServiceDelegate;import com.ufgov.zc.common.zc.publish.IZcEbBulletinServiceDelegate;@SuppressWarnings("unchecked")public class ZcEbProjectEditPanel_dt extends AbstractMainSubEditPanel {  protected static final Logger logger = Logger.getLogger(ZcEbProjectEditPanel_dt.class);  private static final long serialVersionUID = -2539657260090189021L;  private RequestMeta requestMeta;  private FuncButton addButton = new AddButton();  private FuncButton previousButton = new PreviousButton();  private FuncButton saveButton = new SaveButton();  protected FuncButton editButton = new EditButton();  private FuncButton deleteButton = new DeleteButton();  private FuncButton nextButton = new NextButton();  private FuncButton exitButton = new ExitButton();  // 工作流送审  private FuncButton sendButton = new SendButton();  //是否送主任审核  private FuncButton isSendToNextButton = new IsSendToNextButton();  // 工作流收回  private FuncButton callbackButton = new CallbackButton();  // 工作流填写意见审核通过  private FuncButton suggestPassButton = new SuggestAuditPassButton();  // 工作流销审  private FuncButton unAuditButton = new UnauditButton();  // 工作流退回  private FuncButton unTreadButton = new UntreadButton();  // 工作流流程跟踪  private FuncButton traceButton = new TraceButton();  //同意  private FuncButton agreeButton = new AgreeButton();  //不同意  private FuncButton disagreeButton = new DisagreeButton();  //送协办人审核  private FuncButton sendToXieBanButton = new SendToXieBanButton();  // 工作流终审  private FuncButton auditFinalPassButton = new AuditFinalPassButton();  //送采购单位确认  private FuncButton sendToProcurementUnitButton = new SendToProcurementUnitButton();  private JButton addBtnPack = new SubaddButton(false);  private JButton insertBtnPack = new SubinsertButton(false);  private JButton delBtnPack = new SubdelButton(false);  private JButton addBtnPackReq = new SubaddButton(false);  private JButton insertBtnPackReq = new SubinsertButton(false);  private JButton delBtnPackReq = new SubdelButton(false);  private ListCursor listCursor;  private ZcEbProj oldProj;  private String tabStatus;  private ZcEbProjectListPanel_dt listPanel;  private int packSelectRow = 0;  private ZcEbProjectEditFrame_dt dself;  JSaveableSplitPane splitPane;  JTabbedPane tabPanePack;  JTabbedPane tabPaneReq;  private JTablePanel tablePanelPack = new JTablePanel("tablePanelPack");  private JTablePanel tablePanelPackReq = new JTablePanel("tablePanelPackReq");  private JTablePanel tablePanelBidCondition = new JTablePanel("tablePanelBidCondition");  private JTablePanel xunjiaTablePanel = new JTablePanel("tablePanelItemInfo");  private JTablePanel tablePanelXunJia = new JTablePanel("tablePanelXunJia");  private JTablePanel tablePanelProjFile = new JTablePanel("tablePanelProjFile");  private DateFieldEditor xunJiaEndDateField;  private JPanel xunJiaPanel;  protected DateFieldEditor openDt;  private DateFieldEditor itemInfoEndDateField;  private JPanel itemInfoPanel;  public ZcEbBulletinXunJiaBidEditProjPanel billEdit;  public List<ZcEbBulletin> bulletinList = new ArrayList<ZcEbBulletin>();  private String fieldSn;  private String purType;  private BillElementMeta detailPackBillElementMeta = BillElementMeta.getBillElementMetaWithoutNd(ZcEbProjectListPanel_dt.compoId + "_PACK");  private BillElementMeta detailPackReqBillElementMeta = BillElementMeta.getBillElementMetaWithoutNd(ZcEbProjectListPanel_dt.compoId + "_PACKREQ");  private DateFieldEditor tbzzsj = null;//投标截止时间  private static final String tbzzsj_Title_xj = "询价报价截止时间";  private static final String tbzzsj_Title = "投标截止时间";  public ZcEbProjectEditPanel_dt(ListCursor listCursor, String tabStatus, ZcEbProjectListPanel_dt listPanel, ZcEbProjectEditFrame_dt dself) {    super(ZcEbProj.class, listPanel.getBillElementMeta());    this.listCursor = listCursor;    this.tabStatus = tabStatus;    this.listPanel = listPanel;    this.dself = dself;    if (listCursor == null || listCursor.getCurrentObject() == null) {      sendButton.setEnabled(false);      saveButton.setEnabled(true);      editButton.setEnabled(false);      sendToXieBanButton.setEnabled(false);      sendToProcurementUnitButton.setEnabled(false);    } else {      saveButton.setEnabled(false);      if ("draft".equals(this.tabStatus)) {        sendToXieBanButton.setEnabled(false);        sendToProcurementUnitButton.setEnabled(false);        sendButton.setEnabled(true);        editButton.setEnabled(true);      }    }    this.workPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), LangTransMeta.translate("ZC_EB_PROJ_TITLE"),      TitledBorder.CENTER, TitledBorder.TOP, new Font("宋体", Font.BOLD, 15), Color.BLUE));    this.colCount = 3;    init();    requestMeta = listPanel.getRequestMeta();    refreshData();    this.setSize(workPanel.getSize().width - 1, workPanel.getSize().height - 1);    workPanel.setSize(new Dimension(workPanel.getSize().width - 1, workPanel.getSize().height - 1));  }  public String getPurType() {    return purType;  }  public void setPurType(String purType) {    this.purType = purType;  }  public ZcEbProjectListPanel_dt xunJiaList;  protected IZcEbBulletinServiceDelegate zcEbBulletinServiceDelegate = (IZcEbBulletinServiceDelegate) ServiceFactory.create(    IZcEbBulletinServiceDelegate.class, "zcEbBulletinServiceDelegate");  public void setXunJiaPanel(JPanel xunJiaPanel) {    this.xunJiaPanel = xunJiaPanel;  }  @Override  public JComponent createSubBillPanel() {    tabPanePack = new JTabbedPane();    tablePanelPack.init();    tablePanelPack.getSearchBar().setVisible(false);    tablePanelPack.setTablePreferencesKey(this.getClass().getName() + "_detail_table");    tabPanePack.addTab("分  包", null, tablePanelPack, "分包");    JFuncToolBar bottomToolBarPack = new JFuncToolBar();    //    JButton addBtnPack = new SubaddButton(false);    //    JButton insertBtnPack = new SubinsertButton(false);    //    JButton delBtnPack = new SubdelButton(false);    bottomToolBarPack.add(addBtnPack);    bottomToolBarPack.add(insertBtnPack);    bottomToolBarPack.add(delBtnPack);    tablePanelPack.add(bottomToolBarPack, BorderLayout.SOUTH);    addBtnPack.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 添加分包明细        ZcEbPack pack = new ZcEbPack();        pack.setPackName(getNewPackName(tablePanelPack, true));        pack.setPackCode(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_PACK));        ZcEbProjectEditPanel_dt.this.setPackDefaultValue(pack, ZcSettingConstants.PACK_STATUS_DRAFT);        int rowNum = addSub(tablePanelPack, pack);        tablePanelPack.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    insertBtnPack.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 插入分包明细        ZcEbPack pack = new ZcEbPack();        pack.setPackName(getNewPackName(tablePanelPack, false));        pack.setPackCode(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_PACK));        ZcEbProjectEditPanel_dt.this.setPackDefaultValue(pack, ZcSettingConstants.PACK_STATUS_DRAFT);        int rowNum = insertSub(tablePanelPack, pack);        tablePanelPack.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    // 删除项目分包按钮的事件监听    delBtnPack.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        Integer[] checkedRows = deleteSub(tablePanelPack);        if (checkedRows.length > 0) {          if (tablePanelPack.getTable().getRowCount() == 0) {            ZcEbPack pack = new ZcEbPack();            pack.setPackName(getNewPackName(tablePanelPack, true));            pack.setPackCode(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_PACK));            ZcEbProjectEditPanel_dt.this.setPackDefaultValue(pack, "0");            addSub(tablePanelPack, pack);            tablePanelPack.getTable().setRowSelectionInterval(0, 0);            // 设置主表的采购方式            setMainCgType(tablePanelPack.getTable());          } else {            tablePanelPack.getTable().setRowSelectionInterval(0, 0);          }          // 从新计算【项目总预算】          caculateSumMoney(((BeanTableModel) tablePanelPack.getTable().getModel()).getDataBeanList());        }      }    });    //采购文件    tablePanelProjFile.init();    tablePanelProjFile.getSearchBar().setVisible(false);    tablePanelProjFile.setTablePreferencesKey(this.getClass().getName() + "_files_table");    JFuncToolBar bottomToolBarFile = new JFuncToolBar();    JButton addBtnFile = new SubaddButton(false);    JButton insertBtnFile = new SubinsertButton(false);    JButton delBtnFile = new SubdelButton(false);    bottomToolBarFile.add(addBtnFile);    bottomToolBarFile.add(insertBtnFile);    bottomToolBarFile.add(delBtnFile);    tablePanelProjFile.add(bottomToolBarFile, BorderLayout.SOUTH);    addBtnFile.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 采购文件        ZcEbProjZbFile projFile = new ZcEbProjZbFile();        projFile.setUploader(requestMeta.getSvUserName());        projFile.setUploadTime(requestMeta.getSysDate());        int rowNum = addSub(tablePanelProjFile, projFile);        tablePanelProjFile.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    insertBtnFile.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 采购文件        ZcEbProjZbFile projFile = new ZcEbProjZbFile();        projFile.setUploader(requestMeta.getSvUserName());        projFile.setUploadTime(requestMeta.getSysDate());        int rowNum = insertSub(tablePanelProjFile, projFile);        tablePanelProjFile.getTable().setRowSelectionInterval(rowNum, rowNum);      }    });    // 删除采购文件按钮的事件监听    delBtnFile.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        Integer[] checkedRows = deleteSub(tablePanelProjFile);      }    });    tabPaneReq = new JTabbedPane();    tablePanelPackReq.init();    tablePanelPackReq.getSearchBar().setVisible(false);    tablePanelPackReq.setTablePreferencesKey(this.getClass().getName() + "_detailother_table");    tabPaneReq.addTab("分包明细采购内容", null, tablePanelPackReq, "每个分包中明细的采购内容");    JFuncToolBar bottomToolBarPackReq = new JFuncToolBar();    //    JButton addBtnPackReq = new SubaddButton(false);    //    JButton insertBtnPackReq = new SubinsertButton(false);    //    JButton delBtnPackReq = new SubdelButton(false);    bottomToolBarPackReq.add(addBtnPackReq);    bottomToolBarPackReq.add(insertBtnPackReq);    bottomToolBarPackReq.add(delBtnPackReq);    tablePanelPackReq.add(bottomToolBarPackReq, BorderLayout.SOUTH);    addBtnPackReq.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 插入分包采购明细        ZcEbPackReq packReq = new ZcEbPackReq();        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel tableModel = (BeanTableModel) packTable.getModel();        if (packTable.getSelectedRows() != null && packTable.getSelectedRows().length > 0) {          ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToModel(packTable.getSelectedRows()[0]));          packReq.setPackCode(pack.getPackCode());          packReq.getRequirementDetail().setSn(pack.getEntrustCode());          packReq.setPackReqCode(Long.parseLong(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_PACK_REQ)));          ZcEbProjectEditPanel_dt.this.setPackReqDefaultValue(packReq);          addSub(tablePanelPackReq, packReq);        } else {          JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "请先选择一条【分包明细】", "提示", JOptionPane.WARNING_MESSAGE);        }      }    });    insertBtnPackReq.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 插入分包采购明细        ZcEbPackReq packReq = new ZcEbPackReq();        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel tableModel = (BeanTableModel) packTable.getModel();        if (packTable.getSelectedRows() != null && packTable.getSelectedRows().length > 0) {          ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToModel(packTable.getSelectedRows()[0]));          packReq.setPackCode(pack.getPackCode());          packReq.getRequirementDetail().setSn(pack.getEntrustCode());          packReq.setPackReqCode(Long.parseLong(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_PACK_REQ)));          ZcEbProjectEditPanel_dt.this.setPackReqDefaultValue(packReq);          insertSub(tablePanelPackReq, packReq);        } else {          JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "请先选择一条【分包明细】", "提示", JOptionPane.WARNING_MESSAGE);        }      }    });    delBtnPackReq.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        deleteSub(tablePanelPackReq);      }    });    // 投标报名前要求的供应商资质条件    tablePanelBidCondition.init();    tablePanelBidCondition.getSearchBar().setVisible(false);    tablePanelBidCondition.setTablePreferencesKey(this.getClass().getName() + "_con_table");    JFuncToolBar bottomToolBarCon = new JFuncToolBar();    JButton addBtnCon = new SubaddButton(false);    JButton insertBtnCon = new SubinsertButton(false);    JButton delBtnCon = new SubdelButton(false);    bottomToolBarCon.add(addBtnCon);    bottomToolBarCon.add(insertBtnCon);    bottomToolBarCon.add(delBtnCon);    tablePanelBidCondition.add(bottomToolBarCon, BorderLayout.SOUTH);    addBtnCon.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 添加资质明细        ZcEbBidCondition con = new ZcEbBidCondition();        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel tableModel = (BeanTableModel) packTable.getModel();        if (packTable.getSelectedRows() != null && packTable.getSelectedRows().length > 0) {          ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToModel(packTable.getSelectedRows()[0]));          con.setPackCode(pack.getPackCode());          con.setConCode(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_BID_CON_REQ));          int rowNum = addSub(tablePanelBidCondition, con);        } else {          JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "请先选择一条【分包明细】", "提示", JOptionPane.WARNING_MESSAGE);        }      }    });    insertBtnCon.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 插入资质明细        ZcEbBidCondition con = new ZcEbBidCondition();        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel tableModel = (BeanTableModel) packTable.getModel();        if (packTable.getSelectedRows() != null && packTable.getSelectedRows().length > 0) {          ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToModel(packTable.getSelectedRows()[0]));          con.setPackCode(pack.getPackCode());          con.setConCode(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_BID_CON_REQ));          int rowNum = addSub(tablePanelBidCondition, con);        } else {          JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "请先选择一条【分包明细】", "提示", JOptionPane.WARNING_MESSAGE);        }      }    });    // 删除邀请资质按钮的事件监听    delBtnCon.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        Integer[] checkedRows = deleteSub(tablePanelBidCondition);      }    });    /*    * 创建询价panel    */    createItemInfoPanel();    createXunJiaPanel();    tabPanePack.setMinimumSize(new Dimension(240, 200));    tabPaneReq.setMinimumSize(new Dimension(240, 350));    splitPane = new JSaveableSplitPane(JSplitPane.VERTICAL_SPLIT, tabPanePack, tabPaneReq);    splitPane.setDividerDefaultLocation(this.getClass().getName() + "_splitPane_dividerLocation", 200);    splitPane.setContinuousLayout(true);    splitPane.setOneTouchExpandable(true);    // 只显示向下的箭头    //      splitPane.putClientProperty("toExpand", true);    splitPane.setDividerSize(10);    splitPane.setDividerLocation(200);    splitPane.setBackground(dself.getBackground());    return splitPane;  }  //询价明细panel  private void createItemInfoPanel() {    //商品信息    JPanel itemInfoPlanPanel = new JPanel();    itemInfoPlanPanel.setLayout(new FlowLayout());    JLabel itemInfoEndDateLabel = new JLabel("<html>询价结束时间<font color='red'>*</font></html>");    itemInfoEndDateField = new DateFieldEditor("询价结束时间", "plan.bidEndTime", DateFieldEditor.TimeTypeH24);    itemInfoPlanPanel.add(itemInfoEndDateLabel);    itemInfoPlanPanel.add(itemInfoEndDateField);    //    //      JPanel xunJiaPlanPanel = new JPanel();    //      xunJiaPlanPanel.setLayout(new FlowLayout());    //      JLabel xunJiaEndDateLabel = new JLabel("<html>询价结束时间<font color='red'>*</font></html>");    //      xunJiaEndDateField = new DateFieldEditor("询价结束时间", "plan.bidEndTime", DateFieldEditor.TimeTypeH24);    //      xunJiaPlanPanel.add(xunJiaEndDateLabel);    //      xunJiaPlanPanel.add(xunJiaEndDateField);    xunjiaTablePanel.init();    xunjiaTablePanel.getSearchBar().setVisible(false);    xunjiaTablePanel.setTablePreferencesKey(this.getClass().getName() + "_xunjia_table");    JFuncToolBar bottomToolBarXunJia = new JFuncToolBar();    JButton addBtnXunJia = new SubaddButton(false);    JButton insertBtnXunJia = new SubinsertButton(false);    JButton delBtnXunJia = new SubdelButton(false);    bottomToolBarXunJia.add(addBtnXunJia);    bottomToolBarXunJia.add(insertBtnXunJia);    bottomToolBarXunJia.add(delBtnXunJia);    xunjiaTablePanel.add(bottomToolBarXunJia, BorderLayout.SOUTH);    addBtnXunJia.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 插入询价明细        ZcEbXunJia xunJia = new ZcEbXunJia();        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel tableModel = (BeanTableModel) packTable.getModel();        if (packTable.getSelectedRows() != null && packTable.getSelectedRows().length > 0) {          ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToModel(packTable.getSelectedRows()[0]));          xunJia.setPackCode(pack.getPackCode());          xunJia.setXjCode(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_XUN_JIA_REQ));          addSub(xunjiaTablePanel, xunJia);        } else {          JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "请先选择一条【分包明细】", "提示", JOptionPane.WARNING_MESSAGE);        }      }    });    insertBtnXunJia.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 插入询价明细        ZcEbXunJia xunJia = new ZcEbXunJia();        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel tableModel = (BeanTableModel) packTable.getModel();        if (packTable.getSelectedRows() != null && packTable.getSelectedRows().length > 0) {          ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToModel(packTable.getSelectedRows()[0]));          xunJia.setPackCode(pack.getPackCode());          xunJia.setXjCode(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_XUN_JIA_REQ));          insertSub(xunjiaTablePanel, xunJia);        } else {          JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "请先选择一条【分包明细】", "提示", JOptionPane.WARNING_MESSAGE);        }      }    });    delBtnXunJia.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        deleteSub(xunjiaTablePanel);      }    });    itemInfoPanel = new JPanel();    itemInfoPanel.setLayout(new BorderLayout());    itemInfoPanel.add(itemInfoPlanPanel, BorderLayout.NORTH);    itemInfoPanel.add(xunjiaTablePanel, BorderLayout.CENTER);  }  //询价单panel  private void createXunJiaPanel() {    //询价单    JPanel xunJiaPlanPanel = new JPanel();    xunJiaPlanPanel.setLayout(new FlowLayout());    JLabel xunJiaEndDateLabel = new JLabel("<html>询价结束时间<font color='red'>*</font></html>");    //xunJiaEndDateField = new DateFieldEditor("询价结束时间", "plan.bidEndTime", DateFieldEditor.TimeTypeH24);    Integer[] mins = { 0, 30 };    xunJiaEndDateField = new DateFieldEditor("询价结束时间", "plan.bidEndTime", DateFieldEditor.TimeTypeH24, mins, true);    xunJiaPlanPanel.add(xunJiaEndDateLabel);    xunJiaPlanPanel.add(xunJiaEndDateField);    tablePanelXunJia.init();    tablePanelXunJia.getSearchBar().setVisible(false);    tablePanelXunJia.setTablePreferencesKey(this.getClass().getName() + "_xunjia_table");    JFuncToolBar bottomToolBarXunJia = new JFuncToolBar();    JButton addBtnXunJia = new SubaddButton(false);    JButton insertBtnXunJia = new SubinsertButton(false);    JButton delBtnXunJia = new SubdelButton(false);    bottomToolBarXunJia.add(addBtnXunJia);    bottomToolBarXunJia.add(insertBtnXunJia);    bottomToolBarXunJia.add(delBtnXunJia);    tablePanelXunJia.add(bottomToolBarXunJia, BorderLayout.SOUTH);    addBtnXunJia.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 插入询价明细        ZcEbXunJia xunJia = new ZcEbXunJia();        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel tableModel = (BeanTableModel) packTable.getModel();        if (packTable.getSelectedRows() != null && packTable.getSelectedRows().length > 0) {          ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToModel(packTable.getSelectedRows()[0]));          xunJia.setPackCode(pack.getPackCode());          xunJia.setXjCode(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_XUN_JIA_REQ));          addSub(tablePanelXunJia, xunJia);        } else {          JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "请先选择一条【分包明细】", "提示", JOptionPane.WARNING_MESSAGE);        }      }    });    insertBtnXunJia.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 插入询价明细        ZcEbXunJia xunJia = new ZcEbXunJia();        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel tableModel = (BeanTableModel) packTable.getModel();        if (packTable.getSelectedRows() != null && packTable.getSelectedRows().length > 0) {          ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToModel(packTable.getSelectedRows()[0]));          xunJia.setPackCode(pack.getPackCode());          xunJia.setXjCode(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_XUN_JIA_REQ));          insertSub(tablePanelXunJia, xunJia);        } else {          JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "请先选择一条【分包明细】", "提示", JOptionPane.WARNING_MESSAGE);        }      }    });    delBtnXunJia.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        deleteSub(tablePanelXunJia);      }    });    xunJiaPanel = new JPanel();    xunJiaPanel.setLayout(new BorderLayout());    //xunJiaPanel.add(xunJiaPlanPanel, BorderLayout.NORTH);    xunJiaPanel.add(tablePanelXunJia, BorderLayout.CENTER);  }  private void setPackDefaultValue(ZcEbPack pack, String status) {    pack.setTempId(Guid.genID());    pack.setStatus(status);    pack.setIsShowBudget("Y");    pack.setIsFailed("N");    pack.setIsCheckQualification("Y");    pack.setAnalyseType("0");    pack.setSeleType("1");    pack.setPackBudget(new BigDecimal("0.00"));    pack.setBidSum(new BigDecimal("0.00"));    pack.setBidDeposit(new BigDecimal("0.00"));    pack.setLastStatus(status);    ZcEbProj temp = (ZcEbProj) this.listCursor.getCurrentObject();    pack.setProjCode(temp.getProjCode());  }  private void setPackReqDefaultValue(ZcEbPackReq packReq) {    packReq.setTempId(Guid.genID());    ZcEbProj temp = (ZcEbProj) this.listCursor.getCurrentObject();    packReq.setProjCode(temp.getProjCode());  }  private void setOldObject() {    oldProj = this.getProjWithoutTempId();  }  private ZcEbProj getProjWithoutTempId() {    ZcEbProj temp = (ZcEbProj) ObjectUtil.deepCopy(listCursor.getCurrentObject());    List<ZcEbPack> packs = temp.getPackList();    for (ZcEbPack pack : packs) {      List<ZcEbPackReq> reqs = pack.getRequirementDetailList();      for (ZcEbPackReq req : reqs) {        req.setTempId(null);      }    }    return temp;  }  @Override  public void setEditingObject(WfAware editingObject) {    super.setEditingObject(editingObject);    ZcEbProj proj = (ZcEbProj) editingObject;    if (proj.getPlan() != null) {      this.xunJiaEndDateField.setEditObject(editingObject);    }  }  @Override  public List<AbstractFieldEditor> createFieldEditors() {    List<AbstractFieldEditor> editorList = new ArrayList<AbstractFieldEditor>();    AutoNumFieldEditor reqCodeEditor = new AutoNumFieldEditor("项目编号", "projCode");    editorList.add(reqCodeEditor);    TextFieldEditor projName = new TextFieldEditor("项目名称", "projName");    editorList.add(projName);    AsValFieldEditor status = new AsValFieldEditor("状态", "status", ConditionFieldConstants.ZC_VS_PROJ_STATUS);    status.setEnabled(false);    editorList.add(status);    AsValFieldEditor zcPifuCgfs = new AsValFieldEditor("采购方式", "purType", "ZC_VS_PITEM_OPIWAY");    zcPifuCgfs.setEnabled(false);    editorList.add(zcPifuCgfs);    MoneyFieldEditor zcMoneyBiSum = new MoneyFieldEditor("项目预算", "projSum");    zcMoneyBiSum.setEnabled(false);    editorList.add(zcMoneyBiSum);    DateFieldEditor zcWeitoDate = new DateFieldEditor("立项时间", "projDate");    zcWeitoDate.setEnabled(false);//liubo    editorList.add(zcWeitoDate);    //    OrgFieldEditor zcOrg = new OrgFieldEditor("负责部门", "org", false);    //    editorList.add(zcOrg);    TextFieldEditor zcMakeLinkman = new TextFieldEditor("项目负责人", "attnName");    zcMakeLinkman.setEnabled(false);    editorList.add(zcMakeLinkman);    TextFieldEditor zcMakeTel = new TextFieldEditor("负责人电话", "phone");    editorList.add(zcMakeTel);    TextFieldEditor email = new TextFieldEditor("负责人电子邮件", "email");    editorList.add(email);    TextFieldEditor fax = new TextFieldEditor("负责人传真", "fax");    editorList.add(fax);    AsValFieldEditor isPubPurBulletin = new AsValFieldEditor("是否发布采购公告", "isPubPurBulletin", "VS_Y/N");    editorList.add(isPubPurBulletin);    AsValFieldEditor isPubPurResult = new AsValFieldEditor("是否发布采购结果", "isPubPurResult", "VS_Y/N");    editorList.add(isPubPurResult);    TextFieldEditor remark = new TextFieldEditor("备注", "remark");    editorList.add(remark);    TextFieldEditor inputor = new TextFieldEditor("制单人", "inputor");    inputor.setEnabled(false);    editorList.add(inputor);    DateFieldEditor createDate = new DateFieldEditor("制单时间", "inputDate");    createDate.setEnabled(false);//liubo    editorList.add(createDate);    Integer[] allowMinutes = { 0, 10, 20, 30, 40, 50 };    //    DateFieldEditor df = new DateFieldEditor("招标文件公告时间", "plan.sellStartTime", DateFieldEditor.TimeTypeH24, allowMinutes, true);    //    df.setEnabled(false);    //    editorList.add(df);    openDt = new DateFieldEditor("开标时间", "plan.openBidTime", DateFieldEditor.TimeTypeH24, allowMinutes, true);    openDt.setEnabled(false);    tbzzsj = new DateFieldEditor(tbzzsj_Title, "plan.bidEndTime", DateFieldEditor.TimeTypeH24, allowMinutes, true);    tbzzsj.getField().addValueChangeListener(new ValueChangeListener() {      @Override      public void valueChanged(ValueChangeEvent e) {        // TODO Auto-generated method stub        tbzzsjChange();      }    });    tbzzsj.setEnabled(false);    editorList.add(tbzzsj);    editorList.add(openDt);    return editorList;  }  protected void tbzzsjChange() {    // TODO Auto-generated method stub    if (openDt == null)      return;    ZcEbProj proj = (ZcEbProj) listCursor.getCurrentObject();    if (proj == null || tbzzsj.getField().getDate() == null)      return;    //获取开标时间延后投标截止时间差的长度,以小时为单位    String t = "0";    if (ZcSettingConstants.PITEM_OPIWAY_XJ.equals(proj.getPurType())) {      t = AsOptionMeta.getOptVal(ZcSettingConstants.OPT_ZC_OPEN_BID_TIME_SHI_JIAN_CHA_XJ);    }    if (t == null || t.trim().length() == 0) {      t = AsOptionMeta.getOptVal(ZcSettingConstants.OPT_ZC_OPEN_BID_TIME_SHI_JIAN_CHA_DEFAULT);    }    t = t == null ? "0" : t.trim();    double d = new Double(t);    d = 60 * 60 * 1000 * d;    long l = new Double(d).longValue();    Calendar calendar = Calendar.getInstance();    calendar.setTime(tbzzsj.getField().getDate());    Date dt = new Date(tbzzsj.getField().getDate().getTime() + l);    proj.getPlan().setOpenBidTime(dt);    openDt.setValue(proj);  }  @Override  public void initToolBar(JFuncToolBar toolBar) {    toolBar.setModuleCode("ZC");    toolBar.setCompoId(ZcEbProjectListPanel_dt.compoId);    //    toolBar.add(addButton);    toolBar.add(editButton);    toolBar.add(saveButton);    toolBar.add(sendButton);//    toolBar.add(isSendToNextButton);    toolBar.add(suggestPassButton);    toolBar.add(auditFinalPassButton);    //    toolBar.add(sendToProcurementUnitButton);//    toolBar.add(agreeButton);//    toolBar.add(disagreeButton);//    toolBar.add(sendToXieBanButton);    toolBar.add(callbackButton);    toolBar.add(unAuditButton);    toolBar.add(unTreadButton);    toolBar.add(traceButton);    toolBar.add(deleteButton);    toolBar.add(previousButton);    toolBar.add(nextButton);    toolBar.add(exitButton);    addButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopEditing();        // 新增        doAdd();      }    });    saveButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopEditing();        // 保存        doSave();      }    });    editButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doEdit();      }    });    deleteButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopEditing();        // 删除        doDelete();      }    });    sendButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopEditing();        // 送审        doSend();      }    });    isSendToNextButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopEditing();        // 送审        doSendNext();      }    });    callbackButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopEditing();        // 收回        doCallback();      }    });    suggestPassButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent arg0) {        stopEditing();        // 填写意见审核        doSuggestPass();      }    });    unAuditButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopEditing();        // 销审        doUnaudit();      }    });    unTreadButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopEditing();        // 退回        doUntread();      }    });    traceButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doTrace();      }    });    previousButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doPrevious();      }    });    nextButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doNext();      }    });    exitButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doExit();      }    });    auditFinalPassButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        stopEditing();        // 终审        doAudit();      }    });    agreeButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 同意        doAgree();      }    });    disagreeButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 不同意        doDisagree();      }    });    sendToXieBanButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 送协办人        doSendToXieBan();      }    });    sendToProcurementUnitButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        // 送采购单位        doSendToProcurementUnit();      }    });  }  private void stopEditing() {    if (tablePanelPack.getTable().isEditing()) {      tablePanelPack.getTable().getCellEditor().stopCellEditing();    }    if (tablePanelPackReq.getTable().isEditing()) {      tablePanelPackReq.getTable().getCellEditor().stopCellEditing();    }  }  private void doPrevious() {    listCursor.previous();    refreshData();    String projCode = ((ZcEbProj) listCursor.getCurrentObject()).getProjCode();    String purType = ((ZcEbProj) listCursor.getCurrentObject()).getProjCode();    //    dself.removeXJtab();    //    dself.refreshCurrentTab(projCode, "pre");  }  private void doNext() {    listCursor.next();    refreshData();    String projCode = ((ZcEbProj) listCursor.getCurrentObject()).getProjCode();    //    dself.removeXJtab();    //    dself.refreshCurrentTab(projCode, "next");  }  private void doExit() {    ZcEbProj zcEbProj = (ZcEbProj) this.listCursor.getCurrentObject();    try {      dself.checkAndUploadZbfile(zcEbProj);    } catch (Exception e2) {      // TODO Auto-generated catch block      e2.printStackTrace();      JOptionPane.showMessageDialog(null, "本次退出时没有和服务器端进行同步，本地更新可能没有更新到服务器，\n可以下次再进行同步，无法同步原因:" + e2.getMessage());        }    dself.closeWindow();  }  private void refreshAll(ZcEbProj afterSaveProj, boolean isRefreshButton) {    this.listCursor.setCurrentObject(afterSaveProj);    this.setEditingObject(afterSaveProj);    if (this.tablePanelPack.getTable().getSelectedRows() != null && this.tablePanelPack.getTable().getSelectedRows().length > 0) {      this.packSelectRow = this.tablePanelPack.getTable().getSelectedRows()[0];    }    this.refreshSubTableData(afterSaveProj);    setOldObject();    if (isRefreshButton) {      setButtonStatus(afterSaveProj, requestMeta, this.listCursor);    }  }  /*  * 新增  */  private void doAdd() {    sendButton.setEnabled(false);    this.listCursor = new ListCursor(new ArrayList(1), -1);    refreshData();  }  /**   * 保存前校验   *   * @param ZcEbRequirement   * @return   */  private boolean checkBeforeSave() {    List notNullBillElementList = this.listPanel.getBillElementMeta().getNotNullBillElement();    List notNullPackBillElementList = detailPackBillElementMeta.getNotNullBillElement();    List notNullPackReqBillElementList = detailPackReqBillElementMeta.getNotNullBillElement();    ZcEbProj zcEbProj = (ZcEbProj) this.listCursor.getCurrentObject();    StringBuilder errorInfo = new StringBuilder();    String validateInfo = ZcUtil.validateBillElementNull(zcEbProj, notNullBillElementList);    String validatePackInfo = ZcUtil.validateDetailBillElementNull(zcEbProj.getPackList(), notNullPackBillElementList, false);    String validatePackReqInfo = new String();    boolean checkPurType = checkPurType(zcEbProj);    if (!checkPurType) {      errorInfo.append("同一项目下的所有分包的采购方式必须一致：\n");    }    List<String> packCodeLst = new ArrayList<String>();    List<String> packNameLst = new ArrayList<String>();    for (ZcEbPack pack : ((List<ZcEbPack>) (zcEbProj.getPackList()))) {      validatePackReqInfo = ZcUtil.validateDetailBillElementNull(pack.getRequirementDetailList(), notNullPackReqBillElementList, false);      if (validatePackReqInfo.length() != 0) {        validatePackReqInfo = pack.getPackName() + ":" + validatePackReqInfo;      }      if (packCodeLst.contains(pack.getPackName())) {        validatePackInfo = pack.getPackName() + ": 重名了，请重新指定分包编号\n";      } else {        packCodeLst.add(pack.getPackName());      }      if (packNameLst.contains(pack.getPackDesc())) {        validatePackInfo = pack.getPackDesc() + ": 重名了，请重新指定分包名称\n";      } else {        packNameLst.add(pack.getPackDesc());      }    }    String validatePackReqMoney = checkPackReqMoney(zcEbProj);    String validatePackMoney = checkPackMoney(zcEbProj);    if (validateInfo.length() != 0) {      errorInfo.append("项目管理：\n").append(validateInfo.toString()).append("\n");    }    if (validatePackInfo.length() != 0) {      errorInfo.append("项目划分分包：\n").append(validatePackInfo.toString()).append("\n");    }    if (validatePackReqInfo.length() != 0) {      errorInfo.append("分包需求明细：\n").append(validatePackReqInfo.toString()).append("\n");    }    if (validatePackReqMoney.length() > 0) {      errorInfo.append(validatePackReqMoney).append("\n");    }    /*    * 检查是否设置了询价的结束时间    */    for (int i = 0; i < zcEbProj.getPackList().size(); i++) {      ZcEbPack pack = (ZcEbPack) zcEbProj.getPackList().get(i);      if (pack.getPurType() != null) {        if (pack.getPurType().equals(ZcSettingConstants.PITEM_OPIWAY_XJ)) {          if (zcEbProj.getPlan().getBidEndTime() == null) {            errorInfo.append("请设置询价的投标截止时间");            break;          } else {            if (zcEbProj.getPlan().getSellEndTime() == null) {              zcEbProj.getPlan().setSellEndTime(zcEbProj.getPlan().getBidEndTime());            }          }        }      }    }    /* 不用询价单面板了，所以不检查这块的信息       for (int i = 0; i < zcEbProj.getPackList().size(); i++) {      ZcEbPack pack = (ZcEbPack) zcEbProj.getPackList().get(i);      if (pack.getPurType() != null) {        if (pack.getPurType().equals(ZcSettingConstants.PITEM_OPIWAY_XJ)) {          List xjList = pack.getXunJiaList();          if (xjList.size() == 0) {            errorInfo.append("必须填写【商品信息】内容！");          } else {            for (int j = 0; j < xjList.size(); j++) {              ZcEbXunJia xj = (ZcEbXunJia) xjList.get(j);              if (null == xj.getSpName() || "".equals(xj.getSpName())) {                errorInfo.append("【商品信息】第" + (j + 1) + "行中的【商品】列必须填写！");              }              if (xj.getSpNum() < 1) {                errorInfo.append("【商品信息】第" + (j + 1) + "行中的【数量】列必须填写！");              }              if (null == xj.getSpTech() || "".equals(xj.getSpTech())) {                errorInfo.append("【商品信息】第" + (j + 1) + "行中的【规格参数要求】列必须填写！");              }            }          }        }      }    }*/    if (errorInfo.length() != 0) {      JOptionPane.showMessageDialog(this, errorInfo.toString(), "提示", JOptionPane.WARNING_MESSAGE);      return true;    }    if (validatePackMoney.length() > 0) {      int sel = JOptionPane.showConfirmDialog(this, validatePackMoney.toString(), "请判断是否继续", JOptionPane.YES_NO_OPTION);      if (sel == JOptionPane.NO_OPTION) {        return true;      }    }    return false;  }  /**   * 检查项目是否缺少招标书和评标方法   *   * @param projCode   * @return   */  private boolean toCheckZbFileAndEvalElements() {    ZcEbProj zcEbProj = (ZcEbProj) this.listCursor.getCurrentObject();    if (ZcSettingConstants.PITEM_OPIWAY_XJ.equals(zcEbProj.getPurType())) {      return false;    }    String projCode = zcEbProj.getProjCode();    ZbBookOperatorsService bookService = new ZbBookOperatorsService(null);    return bookService.toCheckZbFileAndEvalElements(projCode);  }  /**   *    *   * @return String 返回类型   * @Description: 校验任务单允许可分配金额，校验规则如下:   * <p/>   * 1、一个任务单可以立多个项目 但是该任务单所立的所有项目的预算 金额必须小于或等于任务单金额。   * <p/>   * 2、任务单的可分配金额=任务单总金额-所有招标成功的分包金额。   * <p/>   * 3、如果该任务单下的某个分包招标失败，该分包的金额自动回滚到任务单的可分配金额。   * @since 1.0   */  private String checkPackMoney(ZcEbProj zcEbProj) {    StringBuffer sb = new StringBuffer();    List<ZcEbPack> packs = zcEbProj.getPackList();    for (Iterator iterator = packs.iterator(); iterator.hasNext();) {      ZcEbPack zcEbPack = (ZcEbPack) iterator.next();      //任务单总金额。      BigDecimal entrustMoney = zcEbPack.getEntrust().getZcMoneyBiSum();//updated by wangwei : getZcMakeSum --> getZcMoneyBiSum      //防止空指针错误      entrustMoney = entrustMoney == null ? BigDecimal.ZERO : entrustMoney;      //已经被占用的金额（不包含开标失败的金额）      BigDecimal pbs = this.getSavedPackBudgetSum(zcEbPack.getEntrustCode(), zcEbProj.getProjCode());      //该任务单可使用金额。      BigDecimal surPlusSum = entrustMoney.subtract(pbs);      BigDecimal cpbs = this.getCurrentPackBudgetSum(zcEbProj.getPackList(), zcEbPack.getEntrustCode());      if (zcEbPack.getEntrustCode() == null) {        continue;      }      if (cpbs.compareTo(surPlusSum) == 1) {        sb.append(zcEbPack.getPackName()).append("：【分包预算】必须小于等于任务单可分配【预算金额】，任务单【").append(zcEbPack.getEntrustCode()).append("】允许分配金额为")          .append(surPlusSum.doubleValue() + "元");      }    }    return sb.toString();  }  private String checkPackReqMoney(ZcEbProj zcEbProj) {    StringBuffer sb = new StringBuffer();    List<ZcEbPack> packs = zcEbProj.getPackList();    for (Iterator iterator = packs.iterator(); iterator.hasNext();) {      ZcEbPack zcEbPack = (ZcEbPack) iterator.next();      BigDecimal packMoney = (BigDecimal) ObjectUtils.defaultIfNull(zcEbPack.getPackBudget(), BigDecimal.ZERO);      BigDecimal dsum = BigDecimal.ZERO;      List<ZcEbPackReq> detail = zcEbPack.getRequirementDetailList();      for (Iterator iterator2 = detail.iterator(); iterator2.hasNext();) {        ZcEbPackReq zcEbPackReq = (ZcEbPackReq) iterator2.next();        dsum = dsum.add((BigDecimal) ObjectUtils.defaultIfNull(zcEbPackReq.getRequirementDetail().getItemSum(), BigDecimal.ZERO));      }      if (packMoney.compareTo(dsum) == -1) {        sb.append(zcEbPack.getPackName()).append("：分包采购明细的【预算金额】合计必须小于等于【分包预算】！\n");      }    }    return sb.toString();  }  /**   * @return String 返回类型   * @Description: 校验采购方式，所有分包的采购方式，必须一致，而且要和项目的采购方式一致。   * @since 1.0   */  private boolean checkPurType(ZcEbProj zcEbProj) {    List<ZcEbPack> packList = zcEbProj.getPackList();    String purType = zcEbProj.getPurType();    if (packList.size() > 0) {      for (ZcEbPack pack : packList) {        //为空时直接比较        if (pack.getPurType() == null) {          return purType != null;        }        if (!pack.getPurType().equals(purType)) {          return false;        }      }    }    return true;  }  public void doDelete() {    boolean success = true;    String errorInfo = "";    int num = JOptionPane.showConfirmDialog(this, "确定删除吗", "删除确认", 0);    if (num != 0) {      return;    }    try {      requestMeta.setFuncId(deleteButton.getFuncId());      String projCode = ((ZcEbProj) listCursor.getCurrentObject()).getProjCode();      if (projCode != null) {        listPanel.zcEbProjectServiceDelegate.delete(projCode, this.requestMeta);      }    } catch (Exception e) {      logger.error(e.getMessage(), e);      success = false;      errorInfo += e.getMessage();    }    if (success) {      String projCode = ((ZcEbProj) listCursor.getCurrentObject()).getProjCode();      JOptionPane.showMessageDialog(this, "删除成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();      this.listCursor.removeCurrentObject();      this.refreshData();      this.dself.toRemoveOldPanel();      //      dself.removeXJtab();      //      dself.refreshCurrentTab(projCode, "del");    } else {      JOptionPane.showMessageDialog(this, "删除失败 ！\n" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  public void doEdit() {    ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();    //草稿状态调用新加的方法    if (!"draft".equals(this.tabStatus)) {      updateFieldEditorsEditable();    } else {      updateEditorEditable(true);    }    saveButton.setEnabled(true);    sendButton.setEnabled(false);    //设置表格里的添加、插入、删除按钮是否可用    boolean flag = true;    if (listPanel.getRequestMeta().getSvUserID().equals(proj.getManagerCode())) {      addBtnPack.setEnabled(flag);      insertBtnPack.setEnabled(flag);      delBtnPack.setEnabled(flag);      addBtnPackReq.setEnabled(flag);      insertBtnPackReq.setEnabled(flag);      delBtnPackReq.setEnabled(flag);    } else {      flag = false;      addBtnPack.setEnabled(flag);      insertBtnPack.setEnabled(flag);      delBtnPack.setEnabled(flag);      addBtnPackReq.setEnabled(flag);      insertBtnPackReq.setEnabled(flag);      delBtnPackReq.setEnabled(flag);    }    if (listPanel.getRequestMeta().getSvUserID().equals(proj.getManagerCode()) && proj.getProcessInstId() != null && proj.getProcessInstId() > 0) {      flag = true;    } else {      flag = false;    }    //    previousButton.setVisible(false);    //    nextButton.setVisible(false);  }  public boolean doSave() {    if (checkBeforeSave()) {      return false;    }    if (!isDataChanged()) {      JOptionPane.showMessageDialog(this, "数据没有发生改变，不用保存.", "提示", JOptionPane.INFORMATION_MESSAGE);      saveButton.setEnabled(false);      sendButton.setEnabled(true);      //更新编辑状态      updateEditorEditable(false);      return false;    }    //设置询价的开标时间    //    setXjOpenBidtime();    ZcEbProj afterSaveProj = null;    boolean success = true;    String errorInfo = "";    try {      ZcEbProj proj = (ZcEbProj) listCursor.getCurrentObject();      if (proj.getPackList().size() > 1) {        proj.setIsSplitPack("Y");      } else {        proj.setIsSplitPack("N");      }      requestMeta.setFuncId(saveButton.getFuncId());      afterSaveProj = listPanel.zcEbProjectServiceDelegate.save(proj, this.requestMeta);      sendButton.setEnabled(true);    } catch (Exception e) {      logger.error(e.getMessage(), e);      success = false;      errorInfo += e.getMessage();    }    if (success) {      this.refreshAll(afterSaveProj, false);      JOptionPane.showMessageDialog(this, "保存成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      saveButton.setEnabled(false);      editButton.setEnabled(true);      this.listPanel.refreshCurrentTabData();      ZcEbProj proj = (ZcEbProj) listCursor.getCurrentObject();      //      dself.refreshCurrentTab(proj.getProjCode(), "save");      this.dself.doCreateNewTab(afterSaveProj, false);      //更新编辑状态      updateEditorEditable(false);    } else {      JOptionPane.showMessageDialog(this, "保存失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }    return true;  }  //  private void setXjOpenBidtime() {  //	// TODO Auto-generated method stub  //	  ZcEbProj proj = (ZcEbProj) listCursor.getCurrentObject();  //	  if (ZcSettingConstants.PITEM_OPIWAY_XJ.equals(proj.getPurType())) {  //		  String days=AsOptionMeta.getOptVal(ZcSettingConstants.OPT_ZC_XJ_OPENTIME_SETTING);  //		    //		  if(days!=null && days.trim().length()>0&&Integer.valueOf(days).intValue()>0){  //			  //			  Calendar cd = Calendar.getInstance();  //			  cd.setTime(proj.getPlan().getBidEndTime());  //			  cd.add(Calendar.HOUR_OF_DAY, Integer.valueOf(days).intValue());  //			  proj.getPlan().setOpenBidTime(cd.getTime());  //		  }  //	  }  //}  /**     * 送采购单位     */  private void doSendToProcurementUnit() {    ZcEbProj project = (ZcEbProj) this.listCursor.getCurrentObject();    requestMeta.setFuncId(this.sendToProcurementUnitButton.getFuncId());    executeAudit(project, ZcSettingConstants.IS_GOON_AUDIT_YES, null);  }  /*  * 送审  */  private void doSend() {    if (checkBeforeSave()) {      return;    }    if (toCheckZbFileAndEvalElements()) {      return;    }    boolean success = true;    ZcEbProj afterSaveProj = null;    String errorInfo = "";    //项目执行计划未填写时提示    Map parameter = new HashMap();    ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();    parameter.put("projCode", proj.getProjCode());    if (!ZcSettingConstants.PITEM_OPIWAY_XJ.equals(proj.getPurType())) {      IZcEbBaseServiceDelegate baseDataServiceDelegate = (IZcEbBaseServiceDelegate) ServiceFactory.create(IZcEbBaseServiceDelegate.class,        "zcEbBaseServiceDelegate");      List planList = baseDataServiceDelegate.queryDataForList("ZcEbPlan.getPlanTime", parameter, requestMeta);      if (planList != null && ((ZcEbPlan) planList.get(0)).getSellStartTime() == null) {        JOptionPane.showMessageDialog(this, "[项目执行计划]未制定,请补充！", "提示", JOptionPane.WARNING_MESSAGE);      }    }    try {      requestMeta.setFuncId(this.sendButton.getFuncId());      proj.setAuditorId(WorkEnv.getInstance().getCurrUserId());      afterSaveProj = listPanel.zcEbProjectServiceDelegate.newCommitFN(proj, requestMeta);      listCursor.setCurrentObject(afterSaveProj);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      refreshData();      JOptionPane.showMessageDialog(this, "送审成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      ElementConditionDto dto = new ElementConditionDto();      //      ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();      if (ZcSettingConstants.PITEM_OPIWAY_XJ.equals(proj.getPurType())) {        dto.setDattr1(proj.getProjCode());        AbstractZcEbBulletinEditProjPanel.publishFlag = 1;        List bulletinList = this.zcEbBulletinServiceDelegate.getZcEbBulletinProjList(dto, listPanel.getRequestMeta());        if (bulletinList.size() > 0) {          AbstractZcEbBulletinEditProjPanel.releaseButton.setEnabled(true);        }      }      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "送审失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  private void doSendNext() {    if (isDataChanged()) {      JOptionPane.showMessageDialog(this, "数据发生改变，请先保存.", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();    requestMeta.setFuncId(this.isSendToNextButton.getFuncId());    executeAudit(proj, ZcSettingConstants.IS_GOON_AUDIT_YES, null);  }  private void executeAudit(ZcEbProj proj, Integer isGoonAudit, String defaultMsg) {    GkCommentDialog commentDialog = null;    if (defaultMsg == null) {      commentDialog = new GkCommentDialog(DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),        ModalityType.APPLICATION_MODAL);    } else {      commentDialog = new GkCommentDialog(DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),        ModalityType.APPLICATION_MODAL, defaultMsg);    }    if (commentDialog.cancel) {      return;    }    boolean success = true;    String errorInfo = "";    ZcEbProj afterSaveProj = null;    try {      isGoonAudit = isGoonAudit == null ? 0 : isGoonAudit;      proj.setIsGoonAudit(isGoonAudit);      proj.setComment(commentDialog.getComment());      proj.setAuditorId(WorkEnv.getInstance().getCurrUserId());      listPanel.zcEbProjectServiceDelegate.save(proj, requestMeta);      afterSaveProj = listPanel.zcEbProjectServiceDelegate.auditFN(proj, requestMeta);      listCursor.setCurrentObject(afterSaveProj);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshData();      JOptionPane.showMessageDialog(this, "审核成功！", "提示", JOptionPane.INFORMATION_MESSAGE);    } else {      JOptionPane.showMessageDialog(this, "审核失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  /*  * 收回  */  private void doCallback() {    boolean success = true;    ZcEbProj afterSaveProj = null;    String errorInfo = "";    try {      requestMeta.setFuncId(this.callbackButton.getFuncId());      ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();      proj.setAuditorId(WorkEnv.getInstance().getCurrUserId());      afterSaveProj = listPanel.zcEbProjectServiceDelegate.callbackFN(proj, requestMeta);      listCursor.setCurrentObject(afterSaveProj);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshData();      JOptionPane.showMessageDialog(this, "收回成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "收回失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  /*  * 填写意见审核  */  private void doSuggestPass() {    ZcEbProj project = (ZcEbProj) this.listCursor.getCurrentObject();    requestMeta.setFuncId(this.suggestPassButton.getFuncId());    String jianShenRoleId = AsOptionMeta.getOptVal("OPT_ZC_CGZX_JSKY_ROLE");//监审组员角色    //    if (jianShenRoleId.equals(this.requestMeta.getSvRoleId())) {//如果是监审员，则不修改审批状态    //      Integer auditFlag = project.getIsGoonAudit();    //      executeAudit(project, auditFlag, null);    //    } else {    executeAudit(project, ZcSettingConstants.IS_GOON_AUDIT_NO, null);    //    }  }  /**   * 送协办人   */  private void doSendToXieBan() {    ZcEbProj project = (ZcEbProj) this.listCursor.getCurrentObject();    requestMeta.setFuncId(this.sendToXieBanButton.getFuncId());    executeAudit(project, ZcSettingConstants.SEND_TO_XIE_BAN, null);  }  /**   * 同意   */  private void doAgree() {    ZcEbProj project = (ZcEbProj) this.listCursor.getCurrentObject();    requestMeta.setFuncId(this.agreeButton.getFuncId());    Integer auditFlag = project.getIsGoonAudit();    auditFlag = ZcUtil.getAuditFlagValue(auditFlag, 0, requestMeta);    executeAudit(project, auditFlag, null);  }  /**   * 不同意   */  private void doDisagree() {    ZcEbProj project = (ZcEbProj) this.listCursor.getCurrentObject();    requestMeta.setFuncId(this.disagreeButton.getFuncId());    Integer auditFlag = project.getIsGoonAudit();    auditFlag = ZcUtil.getAuditFlagValue(auditFlag, 1, requestMeta);    executeAudit(project, auditFlag, ZcSettingConstants.AUDIT_DISAGREE_DEFULT_MESSAGE);  }  /*  * 终审  */  private void doAudit() {    if (checkBeforeSave()) {      return;    }    if (isDataChanged()) {      JOptionPane.showMessageDialog(this, "数据发生改变，请先保存.", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    boolean success = true;    ZcEbProj afterSaveProj = null;    String errorInfo = "";    try {      requestMeta.setFuncId(this.auditFinalPassButton.getFuncId());      ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();      proj.setAuditorId(WorkEnv.getInstance().getCurrUserId());      proj.setIsGoonAudit(ZcSettingConstants.SEND_TO_FINAL);      afterSaveProj = listPanel.zcEbProjectServiceDelegate.auditFN(proj, requestMeta);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshAll(afterSaveProj, true);      JOptionPane.showMessageDialog(this, "审核成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "审核失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  /*  * 销审  */  private void doUnaudit() {    requestMeta.setFuncId(unAuditButton.getFuncId());    boolean success = true;    ZcEbProj afterSaveProj = null;    String errorInfo = "";    try {      ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();      proj.setAuditorId(WorkEnv.getInstance().getCurrUserId());      afterSaveProj = listPanel.zcEbProjectServiceDelegate.unAuditFN(proj, requestMeta);      this.listCursor.setCurrentObject(afterSaveProj);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshData();      JOptionPane.showMessageDialog(this, "销审成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "销审失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  /*  * 退回  */  private void doUntread() {    if (checkBeforeSave()) {      return;    }    if (isDataChanged()) {      JOptionPane.showMessageDialog(this, "数据发生改变，请先保存.", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    GkCommentUntreadDialog commentDialog = new GkCommentUntreadDialog(DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),      ModalityType.APPLICATION_MODAL);    if (commentDialog.cancel) {      return;    }    boolean success = true;    ZcEbProj afterSaveProj = null;    String errorInfo = "";    try {      requestMeta.setFuncId(unTreadButton.getFuncId());      ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();      proj.setAuditorId(WorkEnv.getInstance().getCurrUserId());      proj.setComment(commentDialog.getComment());      afterSaveProj = listPanel.zcEbProjectServiceDelegate.untreadFN(proj, requestMeta);      listCursor.setCurrentObject(afterSaveProj);    } catch (Exception e) {      success = false;      logger.error(e.getMessage(), e);      errorInfo += e.getMessage();    }    if (success) {      this.refreshData();      JOptionPane.showMessageDialog(this, "退回成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      this.listPanel.refreshCurrentTabData();    } else {      JOptionPane.showMessageDialog(this, "退回失败 ！" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);    }  }  /*  * 流程跟踪  */  private void doTrace() {    ZcBaseBill bean = (ZcBaseBill) this.listCursor.getCurrentObject();    if (bean == null) {      return;    }    WorkflowTrace.showTraceDialog(bean.getProcessInstId());  }  public boolean isDataChanged() {    if (tablePanelPack.getTable().isEditing()) {      tablePanelPack.getTable().getCellEditor().stopCellEditing();    }    if (tablePanelPackReq.getTable().isEditing()) {      tablePanelPackReq.getTable().getCellEditor().stopCellEditing();    }    return !DigestUtil.digest(oldProj).equals(DigestUtil.digest(this.getProjWithoutTempId()));  }  private void refreshData() {    ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();    //是否新增数据    boolean isNew = false;    if (proj == null) {      //新增数据      isNew = true;      // 新增的单据      proj = new ZcEbProj();      proj.setProjDate(new Date());      proj.setStatus(ZcSettingConstants.PROJECT_STATUS_DRAFT);      proj.setIsPubPurBulletin("Y");      proj.setIsPubPurResult("Y");      proj.setNd(WorkEnv.getInstance().getTransNd());      proj.setOrg(this.requestMeta.getSvOrgCode());      proj.setManager(this.requestMeta.getSvUserName());      proj.setManagerCode(this.requestMeta.getSvUserID());      proj.setInputor(this.requestMeta.getSvUserName());      proj.setInputorId(this.requestMeta.getSvUserID());      proj.setAttnName(this.requestMeta.getSvUserName());      proj.setAttn(this.requestMeta.getSvUserID());      AsEmp emp = new AsEmp();      emp.setUserId(this.requestMeta.getSvUserID());      List list = listPanel.baseDataServiceDelegate.getAsEmpByUserID(emp, requestMeta);      if (list.size() > 0) {        emp = (AsEmp) list.get(0);        proj.setFax(emp.getFax());        proj.setPhone(emp.getPhone());        proj.setEmail(emp.getEmail());      }      proj.setInputDate(new Date());      listCursor.getDataList().add(proj);    } else {      // 打开已有的单据      proj = listPanel.zcEbProjectServiceDelegate.getZcEbProjByProjCode(proj.getProjCode(), requestMeta);      listCursor.setCurrentObject(proj);    }    if (proj.getPlan() == null) {      proj.setPlan(new ZcEbPlan());    }    this.setEditingObject(proj);    refreshSubTableData(proj);    setOldObject();    // 根据工作流模版设置字段是否可编辑    updateWFEditorEditable(proj, requestMeta);    //不是新增则设置默认编辑状态    updateEditorEditable(isNew);    // 根据工作流模版设置功能按钮是否可用    setButtonStatus(proj, requestMeta, this.listCursor);  }  //设置编辑状态  private void updateEditorEditable(boolean isEdit) {    //除去个别不能修改数据，其他设置状态    for (AbstractFieldEditor editor : fieldEditors) {      if (!"projCode".equals(editor.getFieldName()) && !"status".equals(editor.getFieldName()) && !"purType".equals(editor.getFieldName())        && !"projSum".equals(editor.getFieldName()) && !"inputor".equals(editor.getFieldName()) && !"org".equals(editor.getFieldName())        && !"projDate".equals(editor.getFieldName()))        editor.setEnabled(isEdit);    }    // 子表的设置    updateSubTableEditable(isEdit);  }  //设置按钮状态  protected void updateSubTableEditable(boolean isEdit) {    if (getSubTables() != null) {      if (isEdit) {        for (JTablePanel tablePanel : getSubTables()) {          setWFSubTableEditable(tablePanel, true);        }      } else {        for (JTablePanel tablePanel : getSubTables()) {          setWFSubTableEditable(tablePanel, false);        }      }    }    if (this.itemInfoPanel != null) {//询价单面板注释掉，不显示      /* if (xunjiaTablePanel != null) {         setWFSubTableEditable(xunjiaTablePanel, isEdit);       }       if (itemInfoEndDateField != null) {         itemInfoEndDateField.setEditable(isEdit);       }*/    }  }  @Override  protected JTablePanel[] getSubTables() {    JTablePanel[] tables = new JTablePanel[] { tablePanelPack, tablePanelPackReq, tablePanelBidCondition, tablePanelXunJia, tablePanelProjFile };    return tables;  }  private String getNewPackName(JTablePanel tablePanelPack, boolean isAdd) {    String rt = "";    ChangeChineseNumber ch = new ChangeChineseNumber();    if (isAdd) {//如果是追加      TableModel editTableModel = tablePanelPack.getTable().getModel();      int rowCount = editTableModel.getRowCount();      String chinese = ch.doChange(new Integer(rowCount + 1).toString());      rt = "分包" + chinese;    } else {      BeanTableModel editTableModel = (BeanTableModel) tablePanelPack.getTable().getModel();      int selectedRow = tablePanelPack.getTable().getSelectedRow();      if (selectedRow != -1) {        selectedRow = selectedRow + 2;        String chinese = ch.doChange(new Integer(selectedRow).toString());        rt = "分包" + chinese;      } else {        selectedRow = editTableModel.getRowCount() - 1;        String chinese = ch.doChange(new Integer(selectedRow).toString());        rt = "分包" + chinese;      }      List<ZcEbPack> packs = editTableModel.getDataBeanList();      for (int i = selectedRow - 1; i < packs.size(); i++) {        packs.get(i).setPackName("分包" + ch.doChange(new Integer(i + 2).toString()));      }    }    return rt;  }  private void refreshSubTableData(ZcEbProj proj) {    if (proj.getPackList().size() > 0) {      this.tablePanelPack.setTableModel(ZcEbProjectToTableModelConverter.convertPackToTableModel(proj.getPackList()));      ZcEbPack pack = (ZcEbPack) proj.getPackList().get(0);      refreshSubPackReqTable(pack);      refreshSubPackBidCondition(pack);      refreshItemInfoTable(pack);      refreshXunJiaTable(pack);    } else {      ZcEbPack pack = new ZcEbPack();      String pname = getNewPackName(tablePanelPack, true);      pack.setPackName(pname);      pack.setPackCode(ZcUtil.getSequenceNextVal(ZcSettingConstants.SEQUENCE_PACK));      ZcEbProjectEditPanel_dt.this.setPackDefaultValue(pack, ZcSettingConstants.PACK_STATUS_DRAFT);      proj.getPackList().add(pack);      this.tablePanelPack.setTableModel(ZcEbProjectToTableModelConverter.convertPackToTableModel(proj.getPackList()));      refreshSubPackReqTable(pack);      refreshSubPackBidCondition(pack);      refreshItemInfoTable(pack);      refreshXunJiaTable(pack);    }    //设置采购文件内容    refreshProjFileTable(proj);    // 设置默认选中的【项目分包】记录    this.tablePanelPack.getTable().setRowSelectionInterval(this.packSelectRow, this.packSelectRow);    // 翻译分包明细表头列    ZcUtil.translateColName(tablePanelPack.getTable(), ZcEbProjectToTableModelConverter.getPackTableColumnInfo());    // 设置分包明细列类型    setPackTableProperty(tablePanelPack.getTable());    // 设置监听，通过选择的【项目分包】自动更新【分包需求明细】，并判断是否显示询价页签以及更新【询价内容】    addPackTableLisenter(tablePanelPack.getTable());    // 设置监听，通过修改【分包预算】更新【项目总预算】    addPackTableLisenterForBudget(tablePanelPack.getTable());    //翻译条件表头    ZcUtil.translateColName(this.tablePanelBidCondition.getTable(), "ZC_EB_");  }  private void refreshProjFileTable(ZcEbProj proj) {    tablePanelProjFile.setTableModel(ZcEbProjectToTableModelConverter.convertProjFileToTableModel(proj.getProjFileList()));    // 翻译头列    ZcUtil.translateColName(tablePanelProjFile.getTable(), "ZC_EB_");    // 设置文件表列类型    setProjFileTableProperty(tablePanelProjFile.getTable());  }  private void setProjFileTableProperty(JPageableFixedTable table) {    SwingUtil.setTableCellEditor(table, "FILE_NAME", new FileCellEditor("fileName"));    SwingUtil.setTableCellEditor(table, "TYPE", new AsValComboBoxCellEditor("ZC_VS_PROJ_FILE_TYPE"));    SwingUtil.setTableCellRenderer(table, "TYPE", new AsValCellRenderer("ZC_VS_PROJ_FILE_TYPE"));  }  private void refreshSubPackReqTable(ZcEbPack pack) {    tablePanelPackReq.setTableModel(ZcEbProjectToTableModelConverter.convertPackReqToTableModel(pack.getRequirementDetailList()));    // 翻译分包需求明细表头列    ZcUtil.translateColName(tablePanelPackReq.getTable(), ZcEbProjectToTableModelConverter.getPackReqTableColumnInfo());    // 设置分包需求明细列类型    setPackReqTableProperty(tablePanelPackReq.getTable());  }  /*  * 设置监听，通过选择的【项目分包】自动更新【分包需求明细】，并判断是否显示询价页签以及更新【询价内容】  */  private void addPackTableLisenter(final JPageableFixedTable table) {    final BeanTableModel model = (BeanTableModel) table.getModel();    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {      public void valueChanged(ListSelectionEvent e) {        if (!e.getValueIsAdjusting()) {          BeanTableModel tableModel = (BeanTableModel) table.getModel();          ZcEbPack pack;          if (table.getSelectedRows() != null && table.getSelectedRows().length > 0) {            pack = (ZcEbPack) tableModel.getBean(table.convertRowIndexToModel(table.getSelectedRows()[0]));            refreshSubPackReqTable(pack);            refreshSubPackBidCondition(pack);            //            refreshItemInfoTable(pack);            //            refreshXunJiaTable(pack);          }        }      }    });    table.getModel().addTableModelListener(new TableModelListener() {      @Override      public void tableChanged(TableModelEvent e) {        if (e.getType() == TableModelEvent.UPDATE) {          if (e.getColumn() >= 0            && ("".equals(model.getColumnIdentifier(e.getColumn())) || "PUR_TYPE".equals(model.getColumnIdentifier(e.getColumn())))) {            int k = table.getSelectedRow();            if (k < 0)              return;            ZcEbPack pack = (ZcEbPack) model.getBean(table.convertRowIndexToModel(k));            refreshSubPackReqTable(pack);            refreshSubPackBidCondition(pack);            //            refreshItemInfoTable(pack);            //            refreshXunJiaTable(pack);          }        }      }    });  }  /**   * 更新招标报名时需要校验的资质条件   *   * @param pack Administrator   *             <p/>   *             2010-10-23   */  protected void refreshSubPackBidCondition(ZcEbPack pack) {    tablePanelBidCondition.setTableModel(ZcEbProjectToTableModelConverter.convertBidConToTableModel(pack.getBidConditions()));    ZcUtil.translateColName(tablePanelBidCondition.getTable(), "ZC_EB_");  }  /**   * 询价面板刷新和tab页签处理   * @param pack   */  private void refreshItemInfoTable(ZcEbPack pack) {    if (!ZcSettingConstants.PITEM_OPIWAY_XJ.equals(pack.getPurType())) {      if (tabPaneReq.getTabCount() > 1) {        tabPaneReq.remove(itemInfoPanel);      }      return;    }    xunjiaTablePanel.setTableModel(ZcEbProjectToTableModelConverter.convertXunJiaToTableModel(pack.getXunJiaList()));    ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();    if (proj.getPlan() == null) {      ZcEbPlan plan = new ZcEbPlan();      plan.setNd(this.requestMeta.getSvNd());      proj.setPlan(plan);    }    this.itemInfoEndDateField.setEditObject(proj);    ZcUtil.translateColName(xunjiaTablePanel.getTable(), "ZC_EB_");    setXunJiaTableProperty(xunjiaTablePanel.getTable());    if (pack.getPurType() != null) {      purType = pack.getPurType();      if (pack.getPurType().equals(ZcSettingConstants.PITEM_OPIWAY_XJ)) {        if (tabPaneReq.getTabCount() == 1) {          //          tabPaneReq.addTab("商品信息", itemInfoPanel);        }      } else {        if (tabPaneReq.getTabCount() > 1) {          tabPaneReq.remove(itemInfoPanel);        }      }    } else {      if (tabPaneReq.getTabCount() > 1) {        tabPaneReq.remove(itemInfoPanel);      }    }    tabPaneReq.repaint();  }  private void refreshXunJiaTable(ZcEbPack pack) {    tablePanelXunJia.setTableModel(ZcEbProjectToTableModelConverter.convertXunJiaToTableModel(pack.getXunJiaList()));    ZcEbProj proj = (ZcEbProj) this.listCursor.getCurrentObject();    if (proj.getPlan() == null) {      ZcEbPlan plan = new ZcEbPlan();      plan.setNd(this.requestMeta.getSvNd());      proj.setPlan(plan);    }    // this.xunJiaEndDateField.setEditObject(proj);    ZcUtil.translateColName(tablePanelXunJia.getTable(), "ZC_EB_");    setXunJiaTableProperty(tablePanelXunJia.getTable());    fieldSn = pack.getProjCode();    //    if (pack.getPurType() != null) {    //      if (pack.getPurType().equals(ZcSettingConstants.PITEM_OPIWAY_XJ)) {    //        if (tabPaneReq.getTabCount() == 2) {    //          getXunJiaPanel();    //          tabPaneReq.addTab("询价单", xunJiaPanel);    //        }    //      } else {    //        if (tabPaneReq.getTabCount() > 1) {    //          tabPaneReq.remove(xunJiaPanel);    //        }    //      }    //    } else {    //      if (tabPaneReq.getTabCount() > 1) {    //        tabPaneReq.remove(xunJiaPanel);    //      }    //    }    tabPaneReq.repaint();  }  private void setXunJiaTableProperty(JPageableFixedTable table) {    table.setDefaultEditor(String.class, new TextCellEditor());    FileCellEditor fc = new FileCellEditor("spTechFileId", (BeanTableModel) table.getModel());    AsValComboBoxCellEditor acbc = new AsValComboBoxCellEditor("V_SP_UNIT");    SwingUtil.setTableCellEditor(table, "SP_TECH_FILE_NAME", fc);    SwingUtil.setTableCellEditor(table, "SP_NUM", new IntCellEditor(false));    SwingUtil.setTableCellEditor(table, "SP_UNIT", acbc);    SwingUtil.setTableCellRenderer(table, "SP_UNIT", new AsValCellRenderer("V_SP_UNIT"));  }  /*  * 设置监听，通过修改【分包预算】更新【项目总预算】  */  private void addPackTableLisenterForBudget(final JPageableFixedTable table) {    final BeanTableModel model = (BeanTableModel) table.getModel();    model.addTableModelListener(new TableModelListener() {      public void tableChanged(TableModelEvent e) {        //edited by fanl 分包预算放开可以修改，要校验该任务单下的所有分包预算金额之和不能大于任务单预算金额：        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel tableModel = (BeanTableModel) packTable.getModel();        if (packTable.getSelectedRows() != null && packTable.getSelectedRows().length > 0) {          //ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToView(packTable.getSelectedRow()));          //if (pack.getPackBudget() != null && pack.getEntrust().getZcMoneyBiSum() != null) {          //checkEntrustMoney(pack, tableModel);          //}          if (e.getColumn() >= 0 && "PACK_BUDGET".equals(model.getColumnIdentifier(e.getColumn()))) {            //caculateSumMoney(model.getDataBeanList());          }        }      }    });  }  /**   * 返回一个分包对应的任务，除去当前项目，在其他项目中对应的分包预算的合计   *   * @param pack   * @return   */  private BigDecimal getSavedPackBudgetSum(String de, String projCode) {    ElementConditionDto dto = new ElementConditionDto();    dto.setZcText0(de);    List<ZcEbPack> packList = listPanel.zcEbBaseServiceDelegate.getForeignEntitySelectedData("ZcEbProj.getZcEbPackByEntrustCode", dto, requestMeta);    BigDecimal sum = BigDecimal.ZERO;//此任务对应的已经编制的所有分包预算合计（除去此任务在当前页面的对应记录）    for (ZcEbPack zcEbPack : packList) {      if (ZcSettingConstants.PACK_STATUS_CANCEL.equals(zcEbPack.getStatus()) || ZcSettingConstants.PACK_STATUS_SUSPENDED.equals(zcEbPack.getStatus())        || ZcSettingConstants.PACK_STATUS_DELAY.equals(zcEbPack.getStatus())) {//判断的方式修改了一下，        continue;      }      if (!zcEbPack.getProjCode().equals(projCode)) {        sum = sum.add((BigDecimal) ObjectUtils.defaultIfNull(zcEbPack.getPackBudget(), BigDecimal.ZERO));      }    }    return sum;  }  /**   * @param curPack    * @return BigDecimal 返回类型   * @Description: 获取当前所有分包的分包预算总计   * @since 1.0   */  private BigDecimal getCurrentPackBudgetSum(List<ZcEbPack> currProjPacks, String entrustCode) {    BigDecimal currsum = BigDecimal.ZERO;    for (Iterator iterator = currProjPacks.iterator(); iterator.hasNext();) {      ZcEbPack temp = (ZcEbPack) iterator.next();      if (entrustCode != null && entrustCode.equals(temp.getEntrustCode())) {        currsum = currsum.add((BigDecimal) ObjectUtils.defaultIfNull(temp.getPackBudget(), BigDecimal.ZERO));      }    }    return currsum;  }  private boolean checkEntrustMoney(ZcEbPack pack, BeanTableModel tableModel) {    //任务单总预算金额：    BigDecimal entrustMoney = pack.getEntrust().getZcMoneyBiSum();    entrustMoney = entrustMoney == null ? BigDecimal.ZERO : entrustMoney;    if (pack.getEntrustCode() == null) {      return true;    }    //该任务单下所有已经使用的预算金额总计：    BigDecimal sum = getSavedPackBudgetSum(pack.getEntrustCode(), pack.getProjCode());    //该任务单可使用金额。    BigDecimal surPlusSum = entrustMoney.subtract(sum);    List<ZcEbPack> currProjPacks = tableModel.getDataBeanList();    //当前项目所有分包的金额。    BigDecimal allPackSum = getCurrentPackBudgetSum(currProjPacks, pack.getEntrustCode());    //校验当前分包的分包预算金额是否超出任务单剩余分包预算金额    if (allPackSum.compareTo(surPlusSum) == 1) {      //当前分包允许分配金额=该任务单可使用金额-当前项目其他分包占用金额。      BigDecimal bd = surPlusSum.subtract(allPackSum.subtract(pack.getPackBudget()));      double d1 = bd.doubleValue();      pack.setPackBudget(bd);      JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "当前【分包预算】金额大于任务单可分配【预算金额】：当前任务单允许分配金额为" + d1 + "元", "提示",        JOptionPane.WARNING_MESSAGE);      return false;    }    caculateSumMoney(currProjPacks);    return true;  }  /**   * @return BigDecimal 返回类型   * @Description: 获取当前分包可分配金额   * @since 1.0   */  private BigDecimal getSurPlusSum(ZcEbPack curPack, ZcEbEntrust entrust) {    //任务单总预算金额,这里的总金额是取得预算单位申报时的总的计划金额。    BigDecimal entrustMoney = entrust.getZcMoneyBiSum();    ZcEbProj zcEbProj = (ZcEbProj) this.listCursor.getCurrentObject();    //该任务单下所有已经使用的预算金额总计：    BigDecimal sum = getSavedPackBudgetSum(entrust.getSn(), zcEbProj.getProjCode());    //获取分包model里面已经占用的金额。    BeanTableModel tableModel = (BeanTableModel) tablePanelPack.getTable().getModel();    List<ZcEbPack> packs = (List<ZcEbPack>) ObjectUtil.deepCopy(tableModel.getDataBeanList());    for (ZcEbPack temp : packs) {      if (temp.getTempId().equals(curPack.getTempId())) {        packs.remove(temp);        break;      }    }    BigDecimal allPackSum = getCurrentPackBudgetSum(packs, entrust.getSn());    return entrustMoney.subtract(sum.add(allPackSum));  }  /**   * @return void 返回类型   * @Description:项目的预算是所有分包预算之和。   * @since 1.0   */  private void caculateSumMoney(List<ZcEbPack> packList) {    BigDecimal sum = new BigDecimal(0);    for (ZcEbPack pack : packList) {      sum = sum.add((BigDecimal) ObjectUtils.defaultIfNull(pack.getPackBudget(), BigDecimal.ZERO));    }    ZcEbProj beanData = (ZcEbProj) this.listCursor.getCurrentObject();    beanData.setProjSum(sum);    this.setEditingObject(beanData);  }  //  //  public ZcEbBulletinXunJiaBidEditProjPanel getXJPanel(ZcEbProj proj) {  //    ElementConditionDto elementConditionDto = new ElementConditionDto();  //    elementConditionDto.setBillType("XB");  //    elementConditionDto.setDattr1(fieldSn);  //    bulletinList = zcEbBulletinServiceDelegate.getZcEbBulletinProjList(elementConditionDto, requestMeta);  //    ZcEbBulletinXunJiaBidEditProjPanel editPanel = new ZcEbBulletinXunJiaBidEditProjPanel(this.dself, new ListCursor(bulletinList, 0), "0",  //      this.listPanel, fieldSn, proj);  //    return editPanel;  //  }  /**   * @return void 返回类型   * @Description: 需求明细子表，选择需求之后，填充分包需求明细。   * @since 1.0   */  private void fillPackReq(ZcEbPackReq packReq, ZcEbRequirementDetail requirementDetail) {    if (requirementDetail != null) {      packReq.setDetailCode(requirementDetail.getDetailCode());      packReq.getRequirementDetail().setSn(requirementDetail.getSn());      packReq.getRequirementDetail().setName(requirementDetail.getName());      packReq.getRequirementDetail().setZcCatalogueCode(requirementDetail.getZcCatalogueCode());      packReq.getRequirementDetail().setZcCatalogueName(requirementDetail.getZcCatalogueName());      packReq.getRequirementDetail().setArrDate(requirementDetail.getArrDate());      packReq.getRequirementDetail().setBaseReq(requirementDetail.getBaseReq());      packReq.getRequirementDetail().setItemAttach(requirementDetail.getItemAttach());      packReq.getRequirementDetail().setItemAttachBlobid(requirementDetail.getItemAttachBlobid());      packReq.getRequirementDetail().setNum(requirementDetail.getNum());      packReq.getRequirementDetail().setItemSum(requirementDetail.getItemSum());      packReq.getRequirementDetail().setMerPrice(requirementDetail.getMerPrice());      packReq.getRequirementDetail().setPayCond(requirementDetail.getPayCond());      packReq.getRequirementDetail().setServicePromises(requirementDetail.getServicePromises());      packReq.getRequirementDetail().setType(requirementDetail.getType());      packReq.getRequirementDetail().setDescription(requirementDetail.getDescription());    } else {      packReq.setDetailCode(null);      packReq.getRequirementDetail().setSn(null);      packReq.getRequirementDetail().setName(null);      packReq.getRequirementDetail().setZcCatalogueCode(null);      packReq.getRequirementDetail().setZcCatalogueName(null);      packReq.getRequirementDetail().setArrDate(null);      packReq.getRequirementDetail().setBaseReq(null);      packReq.getRequirementDetail().setItemAttach(null);      packReq.getRequirementDetail().setItemAttachBlobid(null);      packReq.getRequirementDetail().setNum(null);      packReq.getRequirementDetail().setItemSum(null);      packReq.getRequirementDetail().setMerPrice(null);      packReq.getRequirementDetail().setPayCond(null);      packReq.getRequirementDetail().setServicePromises(null);      packReq.getRequirementDetail().setType(null);      packReq.getRequirementDetail().setDescription(null);    }  }  /**   * @return void 返回类型   * @Description: 分包子表，选择任务单后填充分包明细   * @since 1.0   */  private void fillPack(ZcEbPack pack, ZcEbEntrust entrust) {    if (entrust != null) {      pack.setEntrust(entrust);      pack.setEntrustCode(entrust.getSn());      pack.setPurType(entrust.getZcPifuCgfs());      pack.setPurContent(entrust.getZcMakeName());      //这里设置的是当前分包允许分配金额；      pack.setPackBudget(getSurPlusSum(pack, entrust));      pack.setPackDesc(entrust.getZcMakeName());      pack.setCoCode(entrust.getCoCode());      pack.setCoName(entrust.getCoName());    } else {      pack.setEntrustCode(null);      pack.setPurType(null);      pack.setPurContent(null);      pack.setPackBudget(new BigDecimal("0.00"));      pack.setPackDesc(null);      pack.setEntrust(null);    }  }  /*  * 设置主表的采购方式  */  private void setMainCgType(JPageableFixedTable tablePack) {    BeanTableModel tablePackModel = (BeanTableModel) tablePack.getModel();    if (tablePackModel.getRowCount() == 1) {      ZcEbProj beanData = (ZcEbProj) this.listCursor.getCurrentObject();      ZcEbPack pack = (ZcEbPack) tablePackModel.getBean(0);      beanData.setPurType(pack.getPurType());      if (ZcSettingConstants.ZC_CGFS_XJ.equals(pack.getPurType())) {        openDt.setVisible(true);        tbzzsj.setName(tbzzsj_Title_xj);      } else {        openDt.setVisible(true);        tbzzsj.setName(tbzzsj_Title);      }      this.setEditingObject(beanData);    }  }  private void setPackTableProperty(final JTable table) {    table.setDefaultEditor(String.class, new TextCellEditor());    final String columNames[] = { "任务单编号", "采购计划编号", "项目名称", "采购单位", "采购方式", "项目预算", "是否涉及进出口", "联系人", "联系人电话" };    IForeignEntityHandler handler = new IForeignEntityHandler() {      @Override      public void excute(List selectedDatas) {        BeanTableModel model = (BeanTableModel) table.getModel();        int k = table.getSelectedRow();        if (k < 0)          return;        int k2 = table.convertRowIndexToModel(k);        ZcEbPack pack = (ZcEbPack) model.getBean(k2);        if (selectedDatas.size() > 0) {          ZcEbEntrust entrust = (ZcEbEntrust) selectedDatas.get(0);          fillPack(pack, entrust);          // 设置项目表的委托机构代码          ZcEbProj temp = (ZcEbProj) listCursor.getCurrentObject();          if (temp.getAgency() == null || "".equals(temp.getAgency())) {            temp.setAgency(entrust.getAgency());          }          temp.setCoCode(entrust.getCoCode());          // 清除【分包需求明细】的内容          JPageableFixedTable packReqTable = tablePanelPackReq.getTable();          BeanTableModel packReqModel = (BeanTableModel) packReqTable.getModel();          if (packReqModel.getRowCount() > 0) {            for (int j = 0; j < packReqModel.getRowCount(); j++) {              ZcEbPackReq packReq = (ZcEbPackReq) packReqModel.getBean(j);              if (entrust.getSn() != null && packReq.getRequirementDetail().getSn() != null                && !entrust.getSn().equals(packReq.getRequirementDetail().getSn())) {                fillPackReq(packReq, null);                int j2 = packReqTable.convertRowIndexToView(j);                packReqModel.fireTableRowsUpdated(j2, j2);              }            }          }          /* 不显示询价单面板，如果是询价，保存时，根据需求明细，自动转换为询价单 --cjl 20120730          //根据分包的采购类型决定是否显示询价单          refreshItemInfoTable(pack);          refreshXunJiaTable(pack);          */        }        model.fireTableRowsUpdated(k, k);        // 从新计算【项目总预算】        caculateSumMoney(((BeanTableModel) tablePanelPack.getTable().getModel()).getDataBeanList());        // 设置主表采购方式        setMainCgType(tablePanelPack.getTable());      }      /*      * 清空外部实体对应的数据      */      public void afterClear() {        BeanTableModel model = (BeanTableModel) table.getModel();        int k = table.getSelectedRow();        if (k < 0)          return;        int k2 = table.convertRowIndexToModel(k);        ZcEbPack pack = (ZcEbPack) model.getBean(k2);        fillPack(pack, null);        // 清除【分包需求明细】的内容        JPageableFixedTable packReqTable = tablePanelPackReq.getTable();        BeanTableModel packReqModel = (BeanTableModel) packReqTable.getModel();        if (packReqModel.getRowCount() > 0) {          for (int j = 0; j < packReqModel.getRowCount(); j++) {            ZcEbPackReq packReq = (ZcEbPackReq) packReqModel.getBean(j);            if (packReq.getDetailCode() != null) {              fillPackReq(packReq, null);              int j2 = packReqTable.convertRowIndexToView(j);              packReqModel.fireTableRowsUpdated(j2, j2);            }          }        }        model.fireTableRowsUpdated(k, k);      }      @Override      public TableModel createTableModel(List showDatas) {        Object data[][] = new Object[showDatas.size()][columNames.length];        for (int i = 0; i < showDatas.size(); i++) {          ZcEbEntrust rowData = (ZcEbEntrust) showDatas.get(i);          int col = 0;          data[i][col++] = rowData.getSn();          data[i][col++] = rowData.getZcMakeCode();          data[i][col++] = rowData.getZcMakeName();          data[i][col++] = rowData.getCoName();          data[i][col++] = AsValDataCache.getName("ZC_VS_PITEM_OPIWAY", rowData.getZcPifuCgfs());          data[i][col++] = rowData.getZcMakeSum();          data[i][col++] = AsValDataCache.getName("VS_Y/N", rowData.getZcIsImp());          data[i][col++] = rowData.getZcMakeLinkman();          data[i][col++] = rowData.getZcMakeTel();        }        MyTableModel model = new MyTableModel(data, columNames) {          @Override          public boolean isCellEditable(int row, int colum) {            return false;          }        };        return model;      }      @Override      public boolean isMultipleSelect() {        return false;      }    };    ElementConditionDto packDto = new ElementConditionDto();    packDto.setBillStatus("exec");    packDto.setExecutor(requestMeta.getSvUserID());    packDto.setCoCode(requestMeta.getSvCoCode());    packDto.setIsNeedSqlFilterData("Y");    ForeignEntityFieldCellEditor entrustEditor = new ForeignEntityFieldCellEditor("ZcEbEntrust.getZcEbEntrustWithPiBan2", packDto, 20, handler,      columNames, "采购计划", "sn");    entrustEditor.getEditor().setEditable(false);    SwingUtil.setTableCellEditor(table, "ENTRUST_CODE", entrustEditor);    final MoneyCellEditor packBudget = new MoneyCellEditor(false);    SwingUtil.setTableCellEditor(table, "PACK_BUDGET", packBudget);    SwingUtil.setTableCellRenderer(table, "PACK_BUDGET", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, "BID_DEPOSIT", new MoneyCellEditor(false));    SwingUtil.setTableCellRenderer(table, "BID_DEPOSIT", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, "SELE_NUM", new IntCellEditor(false));    //SwingUtil.setTableCellRenderer(table, "SELE_NUM", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, "PUR_TYPE", new AsValComboBoxCellEditor("ZC_VS_PITEM_OPIWAY"));    SwingUtil.setTableCellRenderer(table, "PUR_TYPE", new AsValCellRenderer("ZC_VS_PITEM_OPIWAY"));    SwingUtil.setTableCellEditor(table, "ANALYSE_TYPE", new AsValComboBoxCellEditor("VS_ZC_ANALYSE_TYPE"));    SwingUtil.setTableCellRenderer(table, "ANALYSE_TYPE", new AsValCellRenderer("VS_ZC_ANALYSE_TYPE"));    SwingUtil.setTableCellEditor(table, "IS_FAILED", new AsValComboBoxCellEditor("VS_Y/N"));    SwingUtil.setTableCellRenderer(table, "IS_FAILED", new AsValCellRenderer("VS_Y/N"));    SwingUtil.setTableCellEditor(table, "IS_CHECK_QUALIFICATION", new AsValComboBoxCellEditor("VS_Y/N"));    SwingUtil.setTableCellRenderer(table, "IS_CHECK_QUALIFICATION", new AsValCellRenderer("VS_Y/N"));    SwingUtil.setTableCellEditor(table, "IS_SHOW_BUDGET", new AsValComboBoxCellEditor("VS_Y/N"));    SwingUtil.setTableCellRenderer(table, "IS_SHOW_BUDGET", new AsValCellRenderer("VS_Y/N"));    SwingUtil.setTableCellEditor(table, "SELE_TYPE", new AsValComboBoxCellEditor("VS_SELE_TYPE"));    SwingUtil.setTableCellRenderer(table, "SELE_TYPE", new AsValCellRenderer("VS_SELE_TYPE"));    SwingUtil.setTableCellEditor(table, "STATUS", new AsValComboBoxCellEditor("VS_ZC_PACK_STATUS"));    SwingUtil.setTableCellRenderer(table, "STATUS", new AsValCellRenderer("VS_ZC_PACK_STATUS"));    SwingUtil.setTableCellEditor(table, "CO_CODE", new CompanyCellEditor());    SwingUtil.setTableCellRenderer(table, "CO_CODE", new CompanyCellRenderer());    packBudget.getField().addFocusListener(new FocusListener() {      private String lastValue;      @Override      public void focusGained(FocusEvent event) {        // TODO Auto-generated method stub        if (!event.isTemporary()) {          lastValue = packBudget.getField().getText();        }      }      @Override      public void focusLost(FocusEvent event) {        // TODO Auto-generated method stub        if (event.isTemporary()) {          return;        }        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel tableModel = (BeanTableModel) packTable.getModel();        ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToView(packTable.getSelectedRow()));        checkEntrustMoney(pack, tableModel);      }    });  }  /**   * @return void 返回类型   * @Description: 设置需求明细子表的CellEditor   * @since 1.0   */  private void setPackReqTableProperty(final JTable table) {    table.setDefaultEditor(String.class, new TextCellEditor());    final String columNames[] = { "明细需求名称", "品目代码", "品目名称", "要求到货日期", "基本规格要求", "数量", "单价", "单项预算金额", "付款条件", "服务承诺", "描述" };    IForeignEntityHandler handler = new IForeignEntityHandler() {      @Override      public void excute(List selectedDatas) {        BeanTableModel model = (BeanTableModel) table.getModel();        int k = table.getSelectedRow();        if (k < 0)          return;        int k2 = table.convertRowIndexToModel(k);        ZcEbPackReq packReq = (ZcEbPackReq) model.getBean(k2);        if (selectedDatas.size() > 0) {          ZcEbRequirementDetail requirementDetail = (ZcEbRequirementDetail) selectedDatas.get(0);          requirementDetail.setDetailCode(System.currentTimeMillis());          packReq.setDetailCode(requirementDetail.getDetailCode());          packReq.getRequirementDetail().setSn(requirementDetail.getSn());          packReq.getRequirementDetail().setDetailCode(requirementDetail.getDetailCode());          packReq.getRequirementDetail().setName(requirementDetail.getName());          packReq.getRequirementDetail().setZcCatalogueCode(requirementDetail.getZcCatalogueCode());          packReq.getRequirementDetail().setZcCatalogueName(requirementDetail.getZcCatalogueName());          packReq.getRequirementDetail().setArrDate(requirementDetail.getArrDate());          packReq.getRequirementDetail().setBaseReq(requirementDetail.getBaseReq());          packReq.getRequirementDetail().setItemAttach(requirementDetail.getItemAttach());          packReq.getRequirementDetail().setItemAttachBlobid(requirementDetail.getItemAttachBlobid());          packReq.getRequirementDetail().setNum(requirementDetail.getNum());          packReq.getRequirementDetail().setMerPrice(requirementDetail.getMerPrice());          packReq.getRequirementDetail().setItemSum(requirementDetail.getItemSum());          packReq.getRequirementDetail().setPayCond(requirementDetail.getPayCond());          packReq.getRequirementDetail().setServicePromises(requirementDetail.getServicePromises());          packReq.getRequirementDetail().setType(requirementDetail.getType());          packReq.getRequirementDetail().setDescription(requirementDetail.getDescription());        }        model.fireTableRowsUpdated(k, k);      }      /*      * 清空外部实体对应的数据      */      public void afterClear() {        BeanTableModel model = (BeanTableModel) table.getModel();        int k = table.getSelectedRow();        if (k < 0)          return;        int k2 = table.convertRowIndexToModel(k);        ZcEbPackReq packReq = (ZcEbPackReq) model.getBean(k2);        fillPackReq(packReq, null);        model.fireTableRowsUpdated(k, k);      }      /*      * 设置外部实体数据条件      */      public Boolean beforeSelect(ElementConditionDto dto) {        JPageableFixedTable packTable = tablePanelPack.getTable();        BeanTableModel model = (BeanTableModel) packTable.getModel();        int k = packTable.getSelectedRow();        if (k < 0) {          JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "请先选择一个【分 包】", "提示", JOptionPane.WARNING_MESSAGE);          return false;        }        int k2 = packTable.convertRowIndexToModel(k);        ZcEbPack pack = (ZcEbPack) model.getBean(k2);        if (pack.getEntrustCode() == null || "".equals(pack.getEntrustCode().trim())) {          JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "请先指定【分 包】中的【采购计划】", "提示", JOptionPane.WARNING_MESSAGE);          return false;        }        // 设置【分包需求明细】的【明细需求】外部实体的条件        dto.setZcText0(pack.getEntrustCode());        return true;      }      @Override      public TableModel createTableModel(List showDatas) {        Object data[][] = new Object[showDatas.size()][columNames.length];        for (int i = 0; i < showDatas.size(); i++) {          ZcEbRequirementDetail rowData = (ZcEbRequirementDetail) showDatas.get(i);          int col = 0;          data[i][col++] = rowData.getName();          data[i][col++] = rowData.getZcCatalogueCode();          data[i][col++] = rowData.getZcCatalogueName();          data[i][col++] = DateUtil.dateToDdString(rowData.getArrDate());          data[i][col++] = rowData.getBaseReq();          data[i][col++] = rowData.getNum();          data[i][col++] = rowData.getMerPrice();          data[i][col++] = rowData.getItemSum();          data[i][col++] = rowData.getPayCond();          data[i][col++] = rowData.getServicePromises();          data[i][col++] = rowData.getDescription();        }        MyTableModel model = new MyTableModel(data, columNames) {          @Override          public boolean isCellEditable(int row, int colum) {            return false;          }        };        return model;      }      @Override      public boolean isMultipleSelect() {        return false;      }    };    ElementConditionDto packReqDto = new ElementConditionDto();    // 设置需求类型为【业务需求】    packReqDto.setZcText1("1");    ForeignEntityFieldCellEditor detailCodeEditor = new ForeignEntityFieldCellEditor("ZcEbRequirement.getZcEbRequirementDetailBySnWithFN",      packReqDto, 20, handler, columNames, "项目明细需求", "name");    detailCodeEditor.getEditor().setEditable(false);    // 明细需求编号    SwingUtil.setTableCellEditor(table, "ZC_CATALOGUE_CODE", new ZcBCatalogueCellEditor(true));    SwingUtil.setTableCellEditor(table, "NAME", detailCodeEditor);    SwingUtil.setTableCellRenderer(table, "NAME", new LineWrapCellRenderer());    SwingUtil.setTableCellEditor(table, "ARR_DATE", new DateCellEditor());    SwingUtil.setTableCellRenderer(table, "ARR_DATE", new DateCellRenderer());    FileCellEditor fileCellEditor = new FileCellEditor("requirementDetail.itemAttachBlobid");    fileCellEditor.setDeleteFileEnable(false);    SwingUtil.setTableCellEditor(table, "ITEM_ATTACH", fileCellEditor);    SwingUtil.setTableCellEditor(table, "NUM", new IntCellEditor(false));    SwingUtil.setTableCellEditor(table, "ZC_YEAR", new IntCellEditor(false));    final MoneyCellEditor itemSumEditor = new MoneyCellEditor(false);    SwingUtil.setTableCellEditor(table, "ITEM_SUM", itemSumEditor);    SwingUtil.setTableCellRenderer(table, "ITEM_SUM", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, "MER_PRICE", new MoneyCellEditor(false));    SwingUtil.setTableCellRenderer(table, "MER_PRICE", new NumberCellRenderer());    SwingUtil.setTableCellEditor(table, "TYPE", new AsValComboBoxCellEditor("VS_ZC_EB_REQUIREMENT_TYPE"));    SwingUtil.setTableCellRenderer(table, "TYPE", new AsValCellRenderer("VS_ZC_EB_REQUIREMENT_TYPE"));    itemSumEditor.getField().addFocusListener(new FocusListener() {      private String lastValue;      @Override      public void focusGained(FocusEvent event) {        if (!event.isTemporary()) {          lastValue = itemSumEditor.getField().getText();        }      }      @Override      public void focusLost(FocusEvent event) {        // TODO Auto-generated method stub        if (!event.isTemporary()) {          JPageableFixedTable table = tablePanelPackReq.getTable();          final BeanTableModel model = (BeanTableModel) table.getModel();          BigDecimal sum = new BigDecimal(0);          List<ZcEbPackReq> packReqList = model.getDataBeanList();          for (ZcEbPackReq packReq : packReqList) {            sum = sum.add((BigDecimal) ObjectUtils.defaultIfNull(packReq.getRequirementDetail().getItemSum(), BigDecimal.ZERO));          }          JPageableFixedTable packTable = tablePanelPack.getTable();          BeanTableModel tableModel = (BeanTableModel) packTable.getModel();          if (packTable.getSelectedRows() != null && packTable.getSelectedRows().length > 0) {            ZcEbPack pack = (ZcEbPack) tableModel.getBean(packTable.convertRowIndexToView(packTable.getSelectedRow()));            if (sum.compareTo(pack.getPackBudget()) == 1) {              ZcEbPackReq packReq = (ZcEbPackReq) (model.getBean(table.convertRowIndexToView(table.getSelectedRow())));              packReq.getRequirementDetail().setItemSum(new BigDecimal(lastValue));              JOptionPane.showMessageDialog(ZcEbProjectEditPanel_dt.this, "分包明细预算金额合计不能大于分包预算金额", "提示", JOptionPane.WARNING_MESSAGE);            }          }        }      }    });  }  public ZcEbProj getOldProj() {    return oldProj;  }  public FuncButton getEditButton() {    return editButton;  }  public FuncButton getSaveButton() {    return saveButton;  }  public boolean isEditing() {    if ((editButton.isVisible() && editButton.isEnabled()) || (saveButton.isVisible() && saveButton.isEnabled())      || (deleteButton.isVisible() && deleteButton.isEnabled())) {      return true;    }    return false;  }}